Export (0) Print
Expand All

GenericEnumConverter.ConvertFrom Method (ITypeDescriptorContext, CultureInfo, Object)

Converts a String to an Enum type.

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

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

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.

ExceptionCondition
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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft