CultureInfoConverter.ConvertFrom 方法

定義

將指定的值物件轉換為 CultureInfo

public:
 override System::Object ^ ConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value);
public override object ConvertFrom (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value);
public override object? ConvertFrom (System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object value);
override this.ConvertFrom : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj -> obj
Public Overrides Function ConvertFrom (context As ITypeDescriptorContext, culture As CultureInfo, value As Object) As Object

參數

context
ITypeDescriptorContext

提供格式內容的 ITypeDescriptorContext

culture
CultureInfo

CultureInfo,指定要轉換成的文化特性。

value
Object

要進行轉換的 Object

傳回

Object,代表轉換過的值。

例外狀況

value 指定的文化特性無效。

無法執行轉換作業。

備註

這個轉換子只能將 CultureInfo 物件轉換成字串,以及從字串轉換。

可以使用 context 參數來擷取環境的其他資訊,而這個轉換子就是從這個環境叫用的。 這可能是 null,所以一定要檢查。 甚至,內容物件上的屬性可能會傳回 null

適用於

另請參閱