TypeConverter.ConvertFromInvariantString TypeConverter.ConvertFromInvariantString TypeConverter.ConvertFromInvariantString TypeConverter.ConvertFromInvariantString Method

定义

使用不变区域性将该值转换为此转换器的类型。Converts the value to a type of this converter, using the invariant culture.

重载

ConvertFromInvariantString(String) ConvertFromInvariantString(String) ConvertFromInvariantString(String) ConvertFromInvariantString(String)

使用不变区域性将给定字符串转换为此转换器的类型。Converts the given string to the type of this converter, using the invariant culture.

ConvertFromInvariantString(ITypeDescriptorContext, String) ConvertFromInvariantString(ITypeDescriptorContext, String) ConvertFromInvariantString(ITypeDescriptorContext, String) ConvertFromInvariantString(ITypeDescriptorContext, String)

使用不变区域性和指定上下文将给定字符串转换为此转换器的类型。Converts the given string to the type of this converter, using the invariant culture and the specified context.

ConvertFromInvariantString(String) ConvertFromInvariantString(String) ConvertFromInvariantString(String) ConvertFromInvariantString(String)

使用不变区域性将给定字符串转换为此转换器的类型。Converts the given string to the type of this converter, using the invariant culture.

public:
 System::Object ^ ConvertFromInvariantString(System::String ^ text);
public object ConvertFromInvariantString (string text);
member this.ConvertFromInvariantString : string -> obj
Public Function ConvertFromInvariantString (text As String) As Object

参数

text
String String String String

要转换的 StringThe String to convert.

返回

一个 Object,表示已转换的文本。An Object that represents the converted text.

异常

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

注解

默认实现始终返回 nullThe default implementation always returns null.

另请参阅

ConvertFromInvariantString(ITypeDescriptorContext, String) ConvertFromInvariantString(ITypeDescriptorContext, String) ConvertFromInvariantString(ITypeDescriptorContext, String) ConvertFromInvariantString(ITypeDescriptorContext, String)

使用不变区域性和指定上下文将给定字符串转换为此转换器的类型。Converts the given string to the type of this converter, using the invariant culture and the specified context.

public:
 System::Object ^ ConvertFromInvariantString(System::ComponentModel::ITypeDescriptorContext ^ context, System::String ^ text);
public object ConvertFromInvariantString (System.ComponentModel.ITypeDescriptorContext context, string text);
member this.ConvertFromInvariantString : System.ComponentModel.ITypeDescriptorContext * string -> obj
Public Function ConvertFromInvariantString (context As ITypeDescriptorContext, text As String) As Object

参数

context
ITypeDescriptorContext ITypeDescriptorContext ITypeDescriptorContext ITypeDescriptorContext

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

text
String String String String

要转换的 StringThe String to convert.

返回

一个 Object,表示已转换的文本。An Object that represents the converted text.

异常

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

注解

如果字符串不能转换为适当的对象,引发异常。An exception is raised if the string cannot be converted into the appropriate object. 默认实现始终返回 nullThe default implementation always returns null.

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

另请参阅

适用于