T_Cyjb_GenericConvert - CYJB/Cyjb GitHub Wiki
提供将一种类型转换为另一种类型的方法。
System.Object
Cyjb.GenericConvert
Namespace: Cyjb
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public static class GenericConvert
The GenericConvert type exposes the following members.
名称 | 说明 | |
---|---|---|
![]() ![]() |
AddConverter(TInput, TOutput) | 添加将对象从 TInput 类型转换为 TOutput 类型的转换器。 |
![]() ![]() |
AddConverterProvider | 添加指定的类型转换器提供者。 |
![]() ![]() |
CanChangeType | 返回对象能否从 inputType 类型转换为 outputType 类型。 |
![]() ![]() |
ChangeType(Object, Type) | 返回指定类型的对象,其值等效于指定对象。 |
![]() ![]() |
ChangeType(TInput, TOutput)(TInput) | 返回指定类型的对象,其值等效于指定对象。 |
![]() ![]() |
GetConverter(Type, Type) | 获取将对象从 inputType 类型转换为 outputType 类型的转换器。 |
![]() ![]() |
GetConverter(TInput, TOutput)() | 获取将对象从 TInput 类型转换为 TOutput 类型的转换器。 |
![]() ![]() |
GetConverterType | 返回具有指定输入和输出类型的 Converter(TInput, TOutput) 类型。 |
支持预定义的隐式、显式类型转换,用户自定义类型转换(Implicit 和 Explicit 运算符), 并可以通过 AddConverter(TInput, TOutput)(Converter(TInput, TOutput)) 和 AddConverterProvider(IConverterProvider) 方法注入额外的类型转换方法。
默认添加了所有类型转换为字符串,和字符串转换为数字、布尔和日期/时间的额外方法。
所有数值类型转换,都会对溢出进行检查,如果数值不在范围内则会抛出异常。