PropertyConverter.ObjectFromString(Type, MemberInfo, String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將字串值轉換為指定的物件型別。
此 API 支援此產品基礎結構,但無法直接用於程式碼之中。
public:
static System::Object ^ ObjectFromString(Type ^ objType, System::Reflection::MemberInfo ^ propertyInfo, System::String ^ value);
public static object ObjectFromString(Type objType, System.Reflection.MemberInfo propertyInfo, string value);
static member ObjectFromString : Type * System.Reflection.MemberInfo * string -> obj
Public Shared Function ObjectFromString (objType As Type, propertyInfo As MemberInfo, value As String) As Object
參數
- propertyInfo
- MemberInfo
轉換時應使用的屬性。
傳回
objType 類型的物件。
例外狀況
無法從objType參數中建立由 指定的value類型物件。
備註
此 ObjectFromString 方法用於將字串值轉換成物件。
Note
此成員支援 .NET Framework 基礎架構,並非直接從您的程式碼中使用。 若要將字串值轉換成物件,若物件提供Parse方法,請使用Parse該物件的方法。 例如,可以透過該Int32方法從字串建立物件Parse。