TypeConverter.ConvertToString 方法

定義

會將指定值轉換成字串表示。

多載

ConvertToString(ITypeDescriptorContext, CultureInfo, Object)

會使用指定的內容和文化特性資訊,將指定值轉換為字串表示。

ConvertToString(Object)

會將指定值轉換成字串表示。

ConvertToString(ITypeDescriptorContext, Object)

會使用指定的內容,將指定值轉換為字串表示。

ConvertToString(ITypeDescriptorContext, CultureInfo, Object)

來源:
TypeConverter.cs
來源:
TypeConverter.cs
來源:
TypeConverter.cs

會使用指定的內容和文化特性資訊,將指定值轉換為字串表示。

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

參數

context
ITypeDescriptorContext

提供格式內容的 ITypeDescriptorContext

culture
CultureInfo

CultureInfo。 如果傳遞 null,則會採用目前的文化特性。

value
Object

要進行轉換的 Object

傳回

Object,代表轉換過的值。

例外狀況

無法執行轉換作業。

備註

context 參數可以用於擷取環境的其他資訊,而這個轉換子就是從該環境叫用的。 此參數可以是 null,因此請一律檢查它。 甚至,內容物件上的屬性可能會傳回 null

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

另請參閱

適用於

ConvertToString(Object)

來源:
TypeConverter.cs
來源:
TypeConverter.cs
來源:
TypeConverter.cs

會將指定值轉換成字串表示。

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

參數

value
Object

要進行轉換的 Object

傳回

Object,代表轉換過的值。

例外狀況

無法執行轉換作業。

範例

如需此函式的範例,請參閱 TypeConverter 類別。

備註

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

適用於

ConvertToString(ITypeDescriptorContext, Object)

來源:
TypeConverter.cs
來源:
TypeConverter.cs
來源:
TypeConverter.cs

會使用指定的內容,將指定值轉換為字串表示。

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

參數

context
ITypeDescriptorContext

提供格式內容的 ITypeDescriptorContext

value
Object

要進行轉換的 Object

傳回

Object,代表轉換過的值。

例外狀況

無法執行轉換作業。

備註

context 參數可以用於擷取環境的其他資訊,而這個轉換子就是從該環境叫用的。 此參數可以是 null,因此請一律檢查它。 甚至,內容物件上的屬性可能會傳回 null

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

另請參閱

適用於