GenericEnumConverter::ConvertFrom Method (ITypeDescriptorContext^, CultureInfo^, Object^)

 

Converts a String to an Enum type.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

public:
virtual Object^ ConvertFrom(
	ITypeDescriptorContext^ ctx,
	CultureInfo^ ci,
	Object^ data
) override

Parameters

ctx
Type: System.ComponentModel::ITypeDescriptorContext^

The ITypeDescriptorContext object used for type conversions.

ci
Type: System.Globalization::CultureInfo^

The CultureInfo object used during conversion.

data
Type: System::Object^

The String object to convert.

Return Value

Type: System::Object^

The Enum type that represents the data parameter.

Exception Condition
ArgumentException

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

- or -

data starts with a numeric character.

- or -

data includes white space.

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

.NET Framework
Available since 2.0
Return to top
Show: