语言

TypeConverter.ConvertFromInvariantString 方法

定义

使用固定区域性将值转换为此转换器的类型。

重载

名称 说明
ConvertFromInvariantString(String)

使用固定区域性将给定字符串转换为此转换器的类型。

ConvertFromInvariantString(ITypeDescriptorContext, String)

使用固定区域性和指定的上下文将给定字符串转换为此转换器的类型。

ConvertFromInvariantString(String)

Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs

使用固定区域性将给定字符串转换为此转换器的类型。

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

参数

text
String

要 String 转换的。

返回

一个 Object 表示转换后的文本。

例外

无法执行转换。

注解

默认实现始终返回 null。

另请参阅

适用于

ConvertFromInvariantString(ITypeDescriptorContext, String)

Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs

使用固定区域性和指定的上下文将给定字符串转换为此转换器的类型。

public:
 System::Object ^ ConvertFromInvariantString(System::ComponentModel::ITypeDescriptorContext ^ context, System::String ^ text);
public object? ConvertFromInvariantString(System.ComponentModel.ITypeDescriptorContext? context, 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 个。

text
String

要 String 转换的。

返回

一个 Object 表示转换后的文本。

例外

无法执行转换。

注解

如果字符串无法转换为适当的对象,则会引发异常。 默认实现始终返回 null。

使用 context 参数提取有关从中调用此转换器的环境的其他信息。 此参数可以是 null,因此请始终检查它。 此外,上下文对象的属性也可以返回 null。

另请参阅

适用于