mscorlib(4.0.0.0) API with additions
AlphabeticalEnumConverter.cs
1 using System.Collections;
3 
5 {
6  internal class AlphabeticalEnumConverter : EnumConverter
7  {
8  public AlphabeticalEnumConverter(Type type)
9  : base(type)
10  {
11  }
12 
13  public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
14  {
15  if (base.Values == null)
16  {
17  Array values = Enum.GetValues(base.EnumType);
18  object[] array = new object[values.Length];
19  for (int i = 0; i < array.Length; i++)
20  {
21  array[i] = ConvertTo(context, null, values.GetValue(i), typeof(string));
22  }
23  Array.Sort(array, values, 0, values.Length, System.Collections.Comparer.Default);
24  base.Values = new StandardValuesCollection(values);
25  }
26  return base.Values;
27  }
28  }
29 }
Compares two objects for equivalence, where string comparisons are case-sensitive.
Definition: Comparer.cs:11
Definition: __Canon.cs:3
Provides contextual information about a component, such as its container and property descriptor.
Provides a type converter to convert T:System.Enum objects to and from various other representations.
static void Sort(Array array)
Sorts the elements in an entire one-dimensional T:System.Array using the T:System....
Definition: Array.cs:3259
Provides the base class for enumerations.
Definition: Enum.cs:14
static readonly Comparer Default
Represents an instance of T:System.Collections.Comparer that is associated with the P:System....
Definition: Comparer.cs:16
static Array GetValues(Type enumType)
Retrieves an array of the values of the constants in a specified enumeration.
Definition: Enum.cs:457
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition: Array.cs:17
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
unsafe object GetValue(params int[] indices)
Gets the value at the specified position in the multidimensional T:System.Array. The indexes are spec...
Definition: Array.cs:1440
int Length
Gets the total number of elements in all the dimensions of the T:System.Array.
Definition: Array.cs:829