Szerkesztés

Megosztás a következőn keresztül:


TypeConverter.ConvertFromString Method

Definition

Converts the specified text to an object.

Overloads

ConvertFromString(ITypeDescriptorContext, CultureInfo, String)

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

ConvertFromString(String)

Converts the specified text to an object.

ConvertFromString(ITypeDescriptorContext, String)

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

ConvertFromString(ITypeDescriptorContext, CultureInfo, String)

Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs

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);
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

context
ITypeDescriptorContext

An ITypeDescriptorContext that provides a format context.

culture
CultureInfo

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

text
String

The String to convert.

Returns

An Object that represents the converted text.

Exceptions

The conversion cannot be performed.

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

ConvertFromString(String)

Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs

Converts the specified text to an object.

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

Parameters

text
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.

Applies to

ConvertFromString(ITypeDescriptorContext, String)

Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs

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);
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

context
ITypeDescriptorContext

An ITypeDescriptorContext that provides a format context.

text
String

The String to convert.

Returns

An Object that represents the converted text.

Exceptions

The conversion cannot be performed.

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