語言

SelectionRangeConverter.ConvertFrom 方法

定義

利用指定的地點將指定值轉換為轉換器的原生類型。

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

提供格式上下文的A ITypeDescriptorContext 。

culture
CultureInfo

轉換地點資訊。

value
Object

那個 Object 要轉換。

傳回

一個 Object 代表轉換過的 value。

例外狀況

value 是型別 String ,但無法解析成兩個代表日期的字串。

value 是型別 String ,解析成兩個字串,但將其中一個或兩個字串轉換成該 DateTime 字串時並未成功。

備註

此 ConvertFrom 方法專門用於將代表日期範圍的值轉換為 String 其 SelectionRange 表示方式。 其他 String 型別則傳遞給此方法的基底類別實作。

給繼承者的注意事項

可以直接跳過這個方法,自己設定轉換要求。

該 context 參數可用來擷取關於該轉換器所調用環境的額外資訊。 參數可能是 null,因此你應該總是驗證這些資訊。 此外,上下文物件上的屬性也可能回傳 null。

適用於

另請參閱