GenericEnumConverter.ConvertFrom Method

Definition

Converts a String to an Enum type.

public:
 override System::Object ^ ConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ ctx, System::Globalization::CultureInfo ^ ci, System::Object ^ data);
public override object ConvertFrom (System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data);
override this.ConvertFrom : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj -> obj
Public Overrides Function ConvertFrom (ctx As ITypeDescriptorContext, ci As CultureInfo, data As Object) As Object

Parameters

ctx
ITypeDescriptorContext

The ITypeDescriptorContext object used for type conversions.

ci
CultureInfo

The CultureInfo object used during conversion.

data
Object

The String object to convert.

Returns

The Enum type that represents the data parameter.

Exceptions

data is null or an empty string ("").

-or-

data starts with a numeric character.

-or-

data includes white space.

Remarks

The system uses the ConvertFrom method when it reads from a configuration file to convert a String value to an Enum type.

Applies to