TypeConverter.ConvertFromInvariantString 方法
定義
會使用不因文化特性而異,將值轉換為這個轉換子的型別。Converts the value to a type of this converter, using the invariant culture.
多載
ConvertFromInvariantString(String) |
會使用不因文化特性而異,將指定字串轉換為這個轉換子的型別。Converts the given string to the type of this converter, using the invariant culture. |
ConvertFromInvariantString(ITypeDescriptorContext, String) |
會使用不區分的文化特性和指定的內容,將指定的字串轉換為這個轉換子的型別。Converts the given string to the type of this converter, using the invariant culture and the specified context. |
ConvertFromInvariantString(String)
會使用不因文化特性而異,將指定字串轉換為這個轉換子的型別。Converts the given string to the type of this converter, using the invariant culture.
public:
System::Object ^ ConvertFromInvariantString(System::String ^ text);
public object ConvertFromInvariantString (string text);
member this.ConvertFromInvariantString : string -> obj
Public Function ConvertFromInvariantString (text As String) As Object
參數
傳回
表示轉換文字的 Object。An Object that represents the converted text.
例外狀況
無法執行轉換作業。The conversion cannot be performed.
備註
預設的實作 (Implementation) 一定會傳回 null
。The default implementation always returns null
.
另請參閱
適用於
ConvertFromInvariantString(ITypeDescriptorContext, String)
會使用不區分的文化特性和指定的內容,將指定的字串轉換為這個轉換子的型別。Converts the given string to the type of this converter, using the invariant culture and the specified context.
public:
System::Object ^ ConvertFromInvariantString(System::ComponentModel::ITypeDescriptorContext ^ context, System::String ^ text);
public object ConvertFromInvariantString (System.ComponentModel.ITypeDescriptorContext context, string text);
member this.ConvertFromInvariantString : System.ComponentModel.ITypeDescriptorContext * string -> obj
Public Function ConvertFromInvariantString (context As ITypeDescriptorContext, text As String) As Object
參數
- context
- ITypeDescriptorContext
提供格式內容的 ITypeDescriptorContext。An ITypeDescriptorContext that provides a format context.
傳回
表示轉換文字的 Object。An Object that represents the converted text.
例外狀況
無法執行轉換作業。The conversion cannot be performed.
備註
如果無法將字串轉換成適當的物件,就會引發例外狀況。An exception is raised if the string cannot be converted into the appropriate object. 預設的實作 (Implementation) 一定會傳回 null
。The default implementation always returns null
.
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. 甚至,內容物件上的屬性可能會傳回 null
。Also, properties on the context object can return null
.