編輯

共用方式為


PropertyConverter.ObjectFromString(Type, MemberInfo, String) Method

Definition

Converts the string value to the specified object type.

This API supports the product infrastructure and is not intended to be used directly from your code.

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

Parameters

objType
Type

The Type to create from value.

propertyInfo
MemberInfo

The properties to use during conversion.

value
String

The String to convert into an object.

Returns

An object of type objType.

Exceptions

An object of the type specified by objType cannot be created from the value parameter.

Remarks

The ObjectFromString method is used to convert a string value to an object.

Note

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code. To convert a string value to an object, use the Parse method for that object if the object provides a Parse method. For example, an Int32 object can be created from a string through the Parse method.

Applies to