语言

TypeConverter.ConvertToInvariantString 方法

定义

将指定的值转换为区域性固定字符串表示形式。

重载

名称 说明
ConvertToInvariantString(Object)

将指定的值转换为区域性固定字符串表示形式。

ConvertToInvariantString(ITypeDescriptorContext, Object)

使用指定的上下文将指定值转换为区域性固定字符串表示形式。

ConvertToInvariantString(Object)

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

将指定的值转换为区域性固定字符串表示形式。

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

参数

value
Object

要 Object 转换的。

返回

一个 String 表示转换后的值。

例外

无法执行转换。

注解

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

根据值格式化程序实现,可以将返回的字符串传递回值格式化程序以重新创建对象的实例。

另请参阅

适用于

ConvertToInvariantString(ITypeDescriptorContext, Object)

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

使用指定的上下文将指定值转换为区域性固定字符串表示形式。

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

参数

context
ITypeDescriptorContext

提供格式上下文的一 ITypeDescriptorContext 个。

value
Object

要 Object 转换的。

返回

一个 String 表示转换后的值。

例外

无法执行转换。

注解

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

根据值格式化程序实现,可以将返回的字符串传递回值格式化程序以重新创建对象的实例。

另请参阅

适用于