TypeConverter.ConvertFromString TypeConverter.ConvertFromString TypeConverter.ConvertFromString TypeConverter.ConvertFromString Method

Definition

Converts the specified text to an object.

Overloads

ConvertFromString(ITypeDescriptorContext, CultureInfo, String) ConvertFromString(ITypeDescriptorContext, CultureInfo, String) ConvertFromString(ITypeDescriptorContext, CultureInfo, String) ConvertFromString(ITypeDescriptorContext, CultureInfo, String)

Converts the given text to an object, using the specified context and culture information.

ConvertFromString(String) ConvertFromString(String) ConvertFromString(String) ConvertFromString(String)

Converts the specified text to an object.

ConvertFromString(ITypeDescriptorContext, String) ConvertFromString(ITypeDescriptorContext, String) ConvertFromString(ITypeDescriptorContext, String) ConvertFromString(ITypeDescriptorContext, String)

Converts the given text to an object, using the specified context.

ConvertFromString(ITypeDescriptorContext, CultureInfo, String) ConvertFromString(ITypeDescriptorContext, CultureInfo, String) ConvertFromString(ITypeDescriptorContext, CultureInfo, String) ConvertFromString(ITypeDescriptorContext, CultureInfo, String)

Converts the given text to an object, using the specified context and culture information.

public:
 System::Object ^ ConvertFromString(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::String ^ text);
public object ConvertFromString (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, string text);
member this.ConvertFromString : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * string -> obj
Public Function ConvertFromString (context As ITypeDescriptorContext, culture As CultureInfo, text As String) As Object

Parameters

culture
CultureInfo CultureInfo CultureInfo CultureInfo

A CultureInfo. If null is passed, the current culture is assumed.

text
String String String String

The String to convert.

Returns

An Object that represents the converted text.

Exceptions

Remarks

An exception is raised if the string cannot be converted into the appropriate object. The default implementation always returns null.

Use the context parameter to extract additional information about the environment from which this converter is invoked. This parameter can be null, so always check it. Also, properties on the context object can return null.

See Also

ConvertFromString(String) ConvertFromString(String) ConvertFromString(String) ConvertFromString(String)

Converts the specified text to an object.

public:
 System::Object ^ ConvertFromString(System::String ^ text);
public object ConvertFromString (string text);
member this.ConvertFromString : string -> obj
Public Function ConvertFromString (text As String) As Object

Parameters

text
String String String String

The text representation of the object to convert.

Returns

An Object that represents the converted text.

Exceptions

The string cannot be converted into the appropriate object.

Examples

For an example of this function, see the TypeConverter class.

Remarks

The default implementation always returns null.

ConvertFromString(ITypeDescriptorContext, String) ConvertFromString(ITypeDescriptorContext, String) ConvertFromString(ITypeDescriptorContext, String) ConvertFromString(ITypeDescriptorContext, String)

Converts the given text to an object, using the specified context.

public:
 System::Object ^ ConvertFromString(System::ComponentModel::ITypeDescriptorContext ^ context, System::String ^ text);
public object ConvertFromString (System.ComponentModel.ITypeDescriptorContext context, string text);
member this.ConvertFromString : System.ComponentModel.ITypeDescriptorContext * string -> obj
Public Function ConvertFromString (context As ITypeDescriptorContext, text As String) As Object

Parameters

text
String String String String

The String to convert.

Returns

An Object that represents the converted text.

Exceptions

Remarks

An exception is raised if the string cannot be converted into the appropriate object. The default implementation always returns null.

Use the context parameter to extract additional information about the environment from which this converter is invoked. This parameter can be null, so always check it. Also, properties on the context object can return null.

See Also

Applies to