CharConverter.ConvertFrom(ITypeDescriptorContext, CultureInfo, Object) 方法

定义

将给定对象转换为 Unicode 字符对象。Converts the given object to a Unicode character object.

public:
 override System::Object ^ ConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value);
public override object ConvertFrom (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value);
override this.ConvertFrom : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj -> obj
Public Overrides Function ConvertFrom (context As ITypeDescriptorContext, culture As CultureInfo, value As Object) As Object

参数

context
ITypeDescriptorContext

一个 ITypeDescriptorContext,用于提供格式上下文。An ITypeDescriptorContext that provides a format context.

culture
CultureInfo

value 将要转换到的区域性。The culture into which value will be converted.

value
Object

要转换的 ObjectThe Object to convert.

返回

表示转换的 valueObjectAn Object that represents the converted value.

例外

value 不是目标类型的有效值。value is not a valid value for the target type.

无法执行转换。The conversion cannot be performed.

注解

此转换器只能将长度为1、长度为1的字符串转换为字符。This converter can only convert a string, with a length of 1, to and from a character.

context 参数可用于提取有关从中调用该转换器的环境的附加信息。The context parameter can be used to extract additional information about the environment this converter is being invoked from. 此参数可能为 null,因此总是需要检查。This can be null, so always check. 同样,上下文对象的属性可以返回 nullAlso, properties on the context object can return null.

适用于

另请参阅