TypeConverter.ConvertToInvariantString TypeConverter.ConvertToInvariantString TypeConverter.ConvertToInvariantString TypeConverter.ConvertToInvariantString Method

定义

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

重载

ConvertToInvariantString(Object) ConvertToInvariantString(Object) ConvertToInvariantString(Object) ConvertToInvariantString(Object)

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

ConvertToInvariantString(ITypeDescriptorContext, Object) ConvertToInvariantString(ITypeDescriptorContext, Object) ConvertToInvariantString(ITypeDescriptorContext, Object) ConvertToInvariantString(ITypeDescriptorContext, Object)

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

ConvertToInvariantString(Object) ConvertToInvariantString(Object) ConvertToInvariantString(Object) 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

参数

value
Object Object Object Object

要转换的 ObjectThe Object to convert.

返回

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

异常

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

注解

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.

另请参阅

ConvertToInvariantString(ITypeDescriptorContext, Object) ConvertToInvariantString(ITypeDescriptorContext, Object) ConvertToInvariantString(ITypeDescriptorContext, Object) 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

参数

context
ITypeDescriptorContext ITypeDescriptorContext ITypeDescriptorContext ITypeDescriptorContext

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

value
Object Object Object Object

要转换的 ObjectThe Object to convert.

返回

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

异常

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

注解

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

另请参阅

适用于