M_Cyjb_GenericConvert_GetConverter - CYJB/Cyjb GitHub Wiki

GenericConvert.GetConverter 方法 (Type, Type)

获取将对象从 inputType 类型转换为 outputType 类型的转换器。

Namespace: Cyjb
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public static Converter<Object?, Object?>? GetConverter(
	Type inputType,
	Type outputType
)

参数

 

inputType
Type: System.Type
要转换的对象的类型。
outputType
Type: System.Type
要将输入对象转换到的类型。

返回值

Type: Converter(Object, Object)
将对象从 inputType 类型转换为 outputType 类型的转换器。 如果不存在则为 null

Exceptions

 

异常 条件
ArgumentNullException inputTypenull
ArgumentNullException outputTypenull
ArgumentException inputType 包含泛型参数。
ArgumentException outputType 包含泛型参数。

Remarks

尽可能使用泛型方法 GetConverter(TInput, TOutput)(),这样可以避免额外的类型转换。

参见

Reference

GenericConvert 类
GetConverter 重载
Cyjb 命名空间

⚠️ **GitHub.com Fallback** ⚠️