語言

PropertyConverter.ObjectFromString(Type, MemberInfo, String) 方法

定義

將字串值轉換為指定的物件型別。

此 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

參數

objType
Type

從 Typevalue創建 。

propertyInfo
MemberInfo

轉換時應使用的屬性。

value
String

將 String 轉化成一個物件。

傳回

objType 類型的物件。

例外狀況

無法從objType參數中建立由 指定的value類型物件。

備註

此 ObjectFromString 方法用於將字串值轉換成物件。

Note

此成員支援 .NET Framework 基礎架構,並非直接從您的程式碼中使用。 若要將字串值轉換成物件,若物件提供Parse方法,請使用Parse該物件的方法。 例如,可以透過該Int32方法從字串建立物件Parse。

適用於