54 if (sourceType == typeof(
string) || sourceType == typeof(
Enum[]))
58 return base.CanConvertFrom(context, sourceType);
72 return base.CanConvertTo(context, destinationType);
89 string text = (string)value;
90 if (text.IndexOf(
',') != -1)
93 string[] array = text.Split(
',');
94 string[] array2 = array;
95 foreach (
string value2
in array2)
101 return Enum.
Parse(type, text, ignoreCase:
true);
105 throw new FormatException(SR.GetString(
"ConvertInvalidPrimitive", (
string)value, type.
Name), innerException);
112 foreach (
Enum value3
in array3)
118 return base.ConvertFrom(context, culture, value);
134 if (destinationType ==
null)
138 if (destinationType == typeof(
string) && value !=
null)
141 if (value is
IConvertible && value.GetType() != underlyingType)
143 value = ((
IConvertible)value).ToType(underlyingType, culture);
159 object obj = ((
IConvertible)value).ToType(underlyingType2, culture);
184 if (destinationType == typeof(
Enum[]) && value !=
null)
190 long[] array2 =
new long[array.Length];
191 for (
int i = 0; i < array.Length; i++)
200 long[] array3 = array2;
201 foreach (
long num2
in array3)
203 if ((num2 != 0
L && (num2 & num) == num2) || num2 == num)
216 if (!flag && num != 0
L)
220 return list.ToArray();
227 return base.ConvertTo(context, culture, value, destinationType);
238 if (reflectionType ==
null)
240 reflectionType = type;
244 if (fields !=
null && fields.Length != 0)
246 arrayList =
new ArrayList(fields.Length);
248 if (arrayList !=
null)
255 for (
int j = 0; j < customAttributes.Length; j++)
260 if (browsableAttribute ==
null || browsableAttribute.
Browsable)
265 if (fieldInfo.
Name !=
null)
280 if (comparer !=
null)
282 arrayList.
Sort(comparer);
Provides the information necessary to create an instance of an object. This class cannot be inherited...
Converts a base data type to another base data type.
FieldInfo [] GetFields()
Returns all the public fields of the current T:System.Type.
abstract FieldInfo GetField(string name, BindingFlags bindingAttr)
Searches for the specified field, using the specified binding constraints.
static long ToInt64(object value)
Converts the value of the specified object to a 64-bit signed integer.
Compares two objects for equivalence, where string comparisons are case-sensitive.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
Converts the specified value object to an enumeration object.
override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
Gets a value indicating whether this converter can convert an object in the given source type to an e...
override bool IsValid(ITypeDescriptorContext context, object value)
Gets a value indicating whether the given object value is valid for this type.
Type EnumType
Specifies the type of the enumerator this converter is associated with.
Discovers the attributes of a method and provides access to method metadata.
Specifies whether a property or event should be displayed in a Properties window.
Represents the base class for custom attributes.
Discovers the attributes of a field and provides access to field metadata.
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
abstract object [] GetCustomAttributes(bool inherit)
When overridden in a derived class, returns an array of all custom attributes applied to this member.
Represents a collection of values.
Provides contextual information about a component, such as its container and property descriptor.
Indicates that an enumeration can be treated as a bit field; that is, a set of flags.
override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
Gets a value indicating whether this converter can convert an object to the given destination type us...
static object Parse(Type enumType, string value)
Converts the string representation of the name or numeric value of one or more enumerated constants t...
EnumConverter(Type type)
Initializes a new instance of the T:System.ComponentModel.EnumConverter class for the given type.
SecurityAction
Specifies the security actions that can be performed using declarative security.
abstract bool IsDefined(Type attributeType, bool inherit)
When overridden in a derived class, indicates whether one or more attributes of the specified type or...
static bool IsDefined(Type enumType, object value)
Returns an indication whether a constant with a specified value exists in a specified enumeration.
Provides a type converter to convert T:System.Enum objects to and from various other representations.
override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
Gets a value indicating whether the list of standard values returned from M:System....
override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
Converts the given value object to the specified destination type.
Provides the base class for enumerations.
override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
Gets a collection of standard values for the data type this validator is designed for.
Exposes a method that compares two objects.
static Array GetValues(Type enumType)
Retrieves an array of the values of the constants in a specified enumeration.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Represents type declarations: class types, interface types, array types, value types,...
Provides information about the characteristics for a component, such as its attributes,...
abstract string Name
Gets the name of the current member.
bool Browsable
Gets a value indicating whether an object is browsable.
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
override bool GetStandardValuesSupported(ITypeDescriptorContext context)
Gets a value indicating whether this object supports a standard set of values that can be picked from...
The exception that is thrown when one of the arguments provided to a method is not valid.
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
static object ToObject(Type enumType, object value)
Converts the specified object with an integer value to an enumeration member.
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
static Type GetReflectionType(Type type)
Returns a T:System.Type that can be used to perform reflection, given a class type.
virtual IComparer Comparer
Gets an T:System.Collections.IComparer that can be used to sort the values of the enumeration.
string ConvertToInvariantString(object value)
Converts the specified value to a culture-invariant string representation.
StandardValuesCollection Values
Gets or sets a T:System.ComponentModel.TypeConverter.StandardValuesCollection that specifies the poss...
static Type GetUnderlyingType(Type enumType)
Returns the underlying type of the specified enumeration.
Provides information about a specific culture (called a locale for unmanaged code development)....
Defines methods that convert the value of the implementing reference or value type to a common langua...
Provides a unified way of converting types of values to other types, as well as for accessing standar...
static string Format(Type enumType, object value, string format)
Converts the specified value of a specified enumerated type to its equivalent string representation a...
virtual object [] ToArray()
Copies the elements of the T:System.Collections.ArrayList to a new T:System.Object array.
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...
virtual void Sort()
Sorts the elements in the entire T:System.Collections.ArrayList.