System.ComponentModel.CultureInfoConverter.GetStandardValues C# (CSharp) Method

GetStandardValues() public method

public GetStandardValues ( ITypeDescriptorContext context ) : StandardValuesCollection
context ITypeDescriptorContext
return StandardValuesCollection
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) {
           if (values == null) {
               CultureInfo[] installedCultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures | CultureTypes.NeutralCultures);

               // Add Culture.InvariantCulture for a default culture, then sort the array.
               CultureInfo[] array = new CultureInfo[installedCultures.Length + 1];
               Array.Copy(installedCultures, array, installedCultures.Length);
               Array.Sort(array, new CultureComparer());
               Debug.Assert(array[0] == null);
               if (array[0] == null) {
                   //we replace null with the real default culture because there are code paths
                   // where the propgrid will send values from this returned array directly -- instead
                   // of converting it to a string and then back to a value (which this relied on).
                   array[0] = CultureInfo.InvariantCulture; //null isn't the value here -- invariantculture is.
               }

               values = new StandardValuesCollection(array);
           }
           
           return values;
        }