TypeConverter.ConvertToInvariantString 方法

定義

會將指定值轉換成不因文化特性而異的字串表示。

多載

ConvertToInvariantString(Object)

會將指定值轉換成不因文化特性而異的字串表示。

ConvertToInvariantString(ITypeDescriptorContext, Object)

會使用指定的內容,將指定值轉換成不因文化特性而異的字串表示。

ConvertToInvariantString(Object)

來源:
TypeConverter.cs
來源:
TypeConverter.cs
來源:
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)

來源:
TypeConverter.cs
來源:
TypeConverter.cs
來源:
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

視實作值格式子而定,可能會將傳回的字串傳回至值格式器,以重新建立 對象的實例。

另請參閱

適用於