InternalSort() 보호된 메소드

protected InternalSort ( IComparer sorter ) : void
sorter IComparer
리턴 void
예제 #1
0
        public virtual PropertyDescriptorCollection Sort(string[] order, IComparer comparer)
        {
            PropertyDescriptorCollection col = CloneCollection();

            if (order != null)
            {
                ArrayList sorted = col.ExtractItems(order);
                col.InternalSort(comparer);
                sorted.AddRange(col.properties);
                col.properties = sorted;
            }
            else
            {
                col.InternalSort(comparer);
            }
            return(col);
        }
        /// <summary>Sorts the members of this collection. The specified order is applied first, followed by the sort using the specified <see cref="T:System.Collections.IComparer" />.</summary>
        /// <returns>A new <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> that contains the sorted <see cref="T:System.ComponentModel.PropertyDescriptor" /> objects.</returns>
        /// <param name="names">An array of strings describing the order in which to sort the <see cref="T:System.ComponentModel.PropertyDescriptor" /> objects in this collection. </param>
        /// <param name="comparer">A comparer to use to sort the <see cref="T:System.ComponentModel.PropertyDescriptor" /> objects in this collection. </param>
        public virtual PropertyDescriptorCollection Sort(string[] order, IComparer comparer)
        {
            PropertyDescriptorCollection propertyDescriptorCollection = CloneCollection();

            if (order != null)
            {
                ArrayList arrayList = propertyDescriptorCollection.ExtractItems(order);
                propertyDescriptorCollection.InternalSort(comparer);
                arrayList.AddRange(propertyDescriptorCollection.properties);
                propertyDescriptorCollection.properties = arrayList;
            }
            else
            {
                propertyDescriptorCollection.InternalSort(comparer);
            }
            return(propertyDescriptorCollection);
        }