Exemplo n.º 1
0
 /// <include file='doc\StringSorter.uex' path='docs/doc[@for="StringSorter.Sort11"]/*' />
 /// <devdoc>
 ///     Sorts a range in a string array and a range in an object array based on
 ///     the elements of the string array. Elements in the <code>keys</code>
 ///     array specify the sort keys for corresponding elements in the
 /// <code>items</code> array. The range of elements given by the
 /// <code>index</code> and <code>count</code> parameters is sorted in both
 ///     arrays according to the given locale and sorting options.
 ///     If the <code>keys</code> parameter is <code>null</code>, the sort keys
 ///     are instead computed by calling the <code>toString</code> method of each
 ///     element in the <code>items</code> array.
 /// <code>null</code> keys always sort before a non-null keys.
 ///     The <code>options</code> parameter is a combination of zero or more of
 ///     the following flags: <code>IGNORECASE</code>, <code>IGNOREKANATYPE</code>,
 /// <code>IGNORENONSPACE</code>, <code>IGNORESYMBOLS</code>,
 /// <code>IGNOREWIDTH</code>, <code>STRINGSORT</code>, and
 /// <code>DESCENDING</code>.
 /// </devdoc>
 public static void Sort(CultureInfo culture, string[] keys, object[] items, int index, int count, int options)
 {
     // keys and items have to be the same length
     //
     if ((items == null) ||
         ((keys != null) && (keys.Length != items.Length)))
     {
         throw new ArgumentException(string.Format(SR.ArraysNotSameSize,
                                                   "keys",
                                                   "items"));
     }
     if (count > 1)
     {
         StringSorter sorter = new StringSorter(culture, keys, items, options);
         sorter.QuickSort(index, index + count - 1);
     }
 }
Exemplo n.º 2
0
 /// <include file='doc\StringSorter.uex' path='docs/doc[@for="StringSorter.Sort11"]/*' />
 /// <devdoc>
 ///     Sorts a range in a string array and a range in an object array based on
 ///     the elements of the string array. Elements in the <code>keys</code>
 ///     array specify the sort keys for corresponding elements in the
 /// <code>items</code> array. The range of elements given by the
 /// <code>index</code> and <code>count</code> parameters is sorted in both
 ///     arrays according to the given locale and sorting options.
 ///     If the <code>keys</code> parameter is <code>null</code>, the sort keys
 ///     are instead computed by calling the <code>toString</code> method of each
 ///     element in the <code>items</code> array.
 /// <code>null</code> keys always sort before a non-null keys.
 ///     The <code>options</code> parameter is a combination of zero or more of
 ///     the following flags: <code>IGNORECASE</code>, <code>IGNOREKANATYPE</code>,
 /// <code>IGNORENONSPACE</code>, <code>IGNORESYMBOLS</code>,
 /// <code>IGNOREWIDTH</code>, <code>STRINGSORT</code>, and
 /// <code>DESCENDING</code>.
 /// </devdoc>
 public static void Sort(CultureInfo culture, string[] keys, object[] items, int index, int count, int options) {
     // keys and items have to be the same length
     //
     if ((items == null)
         || ((keys != null) && (keys.Length != items.Length)))
         throw new ArgumentException(SR.GetString(SR.ArraysNotSameSize,
                                                            "keys",
                                                            "items"));
     if (count > 1) {
         StringSorter sorter = new StringSorter(culture, keys, items, options);
         sorter.QuickSort(index, index + count - 1);
     }
 }