We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
Article:
 |
|
Implementing Custom Data Bindable Classes: CollectionBase
|
| Subject: |
|
Using objects with more than 1 property |
| Date: |
|
2004-09-13 16:09:47 |
| From: |
|
jamesstill
|
Response to: Using objects with more than 1 property
|
|
Doug, you do need to implement against IComparer for each sort property. Once that's done, I'd modify the Sort method accordingly:
public void Sort(SortType eType)
{
switch(eType)
{
case SortType.Name:
IComparer NameSorter = new _
AscendingNameSorter();
InnerList.Sort(NameSorter);
break;
// next case etc.
}
}
In this case, you'd have a public enum in the namespace defining the sort type options. Hope this helps.
|