Exemple #1
0
        // Constructs a new sorted list containing a copy of the entries in the
        // given dictionary. The elements of the sorted list are ordered according
        // to the given IComparer implementation. If comparer is
        // null, the elements are compared to each other using the
        // IComparable interface, which in that case must be implemented
        // by the keys of all entries in the the given dictionary as well as keys
        // subsequently added to the sorted list.
        //
        public SortedList(IDictionary d, IComparer comparer)
            : this(comparer, (d != null ? d.Count : 0))
        {
            if (d == null)
            {
                throw new ArgumentNullException("d");
            }

            d.Keys.CopyTo(keys, 0);
            d.Values.CopyTo(values, 0);
            Array.Sort(keys, values, comparer.As <IComparer <object> >());
            _size = d.Count;
        }
Exemple #2
0
 //[JsMethod(Name = "")] //HACK! TODO: FIX!
 public static void Sort(JsArray array, IComparer cmp)
 {
     Sort(array.As <object[]>(), cmp.As <IComparer <object> >());
 }