TypeConverter.ConvertToInvariantString 方法

定義

會將指定值轉換成不因文化特性而異的字串表示。Converts the specified value to a culture-invariant string representation.

多載

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

參數

value
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)

會使用指定的內容,將指定值轉換成不因文化特性而異的字串表示。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

提供格式內容的 ITypeDescriptorContextAn ITypeDescriptorContext that provides a format context.

value
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.

另請參閱

適用於