Exemplo n.º 1
0
        /// <summary>
        ///     Constructs a StringSorter. Instances are created by the sort() routines,
        ///     but never by the user.
        /// </summary>
        private StringSorter(CultureInfo culture, string[] keys, object[] items, int options)
        {
            if (keys == null)
            {
                if (items is string[])
                {
                    keys  = (string[])items;
                    items = null;
                }
                else
                {
                    keys = new string[items.Length];
                    for (int i = 0; i < items.Length; i++)
                    {
                        object item = items[i];
                        if (item != null)
                        {
                            keys[i] = item.ToString();
                        }
                    }
                }
            }
            this.keys  = keys;
            this.items = items;
            lcid       = culture == null?SafeNativeMethods.GetThreadLocale() : culture.LCID;

            this.options = options & CompareOptions;
            descending   = (options & Descending) != 0;
        }
Exemplo n.º 2
0
 private StringSorter(CultureInfo culture, string[] keys, object[] items, int options)
 {
     if (keys == null)
     {
         if (items is string[])
         {
             keys  = (string[])items;
             items = null;
         }
         else
         {
             keys = new string[items.Length];
             for (int i = 0; i < items.Length; i++)
             {
                 object obj2 = items[i];
                 if (obj2 != null)
                 {
                     keys[i] = obj2.ToString();
                 }
             }
         }
     }
     this.keys       = keys;
     this.items      = items;
     this.lcid       = (culture == null) ? SafeNativeMethods.GetThreadLocale() : culture.LCID;
     this.options    = options & 0x31007;
     this.descending = (options & -2147483648) != 0;
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Compares two strings using the default locale with the given set of
 ///     string comparison flags.
 /// </summary>
 public static int Compare(string s1, string s2, int options)
 {
     return(Compare(SafeNativeMethods.GetThreadLocale(), s1, s2, options));
 }