Example #1
0
 // Internal version of "Sort".
 private void InternalSort(String[] names, IComparer comparer)
 {
     if (comparer == null)
     {
         comparer = new TypeDescriptor.DescriptorComparer();
     }
     if (names != null && names.Length > 0)
     {
         // Copy across elements from "names" before
         // sorting the main list and appending it.
         ArrayList newList = new ArrayList(list.Count);
         foreach (String name in names)
         {
             PropertyDescriptor descr = Find(name, false);
             if (descr != null)
             {
                 newList.Add(descr);
                 list.Remove(descr);
             }
         }
         list.Sort(comparer);
         foreach (PropertyDescriptor ed in list)
         {
             newList.Add(ed);
         }
         list = newList;
     }
     else
     {
         // No names, so just sort the main list.
         list.Sort(comparer);
     }
 }
	// Internal version of "Sort".
	private void InternalSort(String[] names, IComparer comparer)
			{
				if(comparer == null)
				{
					comparer = new TypeDescriptor.DescriptorComparer();
				}
				if(names != null && names.Length > 0)
				{
					// Copy across elements from "names" before
					// sorting the main list and appending it.
					ArrayList newList = new ArrayList(list.Count);
					foreach(String name in names)
					{
						EventDescriptor descr = Find(name, false);
						if(descr != null)
						{
							newList.Add(descr);
							list.Remove(descr);
						}
					}
					list.Sort(comparer);
					foreach(EventDescriptor ed in list)
					{
						newList.Add(ed);
					}
					list = newList;
				}
				else
				{
					// No names, so just sort the main list.
					list.Sort(comparer);
				}
			}