TypeConverter.ConvertToInvariantString Method

Definition

将指定值转换为区域性不变的字符串表示形式。Converts the specified value to a culture-invariant string representation.

Overloads

ConvertToInvariantString(Object)

将指定值转换为区域性不变的字符串表示形式。Converts the specified value to a culture-invariant string representation.

ConvertToInvariantString(ITypeDescriptorContext, Object)

使用指定的上下文将指定的值转换为区域性不变的字符串表示形式。Converts the specified value to a culture-invariant string representation, using the specified context.

ConvertToInvariantString(Object)

将指定值转换为区域性不变的字符串表示形式。Converts the specified value to a culture-invariant string representation.

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

Parameters

value
Object

要转换的 ObjectThe Object to convert.

Returns

String

String,表示已转换的值。A String that represents the converted value.

Exceptions

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

Remarks

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

根据值格式化程序的实现,可能可以将返回的字符串传回值格式化程序,以重新创建对象的实例。Depending on the implementation of the value formatter, it might be possible to pass the returned string back into the value formatter to re-create an instance of the object.

See also

ConvertToInvariantString(ITypeDescriptorContext, Object)

使用指定的上下文将指定的值转换为区域性不变的字符串表示形式。Converts the specified value to a culture-invariant string representation, using the specified context.

public:
 System::String ^ ConvertToInvariantString(System::ComponentModel::ITypeDescriptorContext ^ context, System::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

Parameters

context
ITypeDescriptorContext

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

value
Object

要转换的 ObjectThe Object to convert.

Returns

String

String,表示已转换的值。A String that represents the converted value.

Exceptions

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

Remarks

使用 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.

根据值格式化程序的实现,可能可以将返回的字符串传回值格式化程序,以重新创建对象的实例。Depending on the implementation of the value formatter, it might be possible to pass the returned string back into the value formatter to re-create an instance of the object.

See also

Applies to