G
Guest
I have implemented custom sorting and searches on my complex objects (they
contain properties and collections) using IComparer and BinarySearch. I knew
they before doing a search you had to sort your collection, but I found out
the hard way yesterday that it has to be sorted on the same property as you
are searching on. Fine. But now my problem is that while displaying this
collection data to the user I have to search on a different property then the
collection is currently sorted on.
For example, the user has chosen to sort the data on PropertyA. An event
happens and I need to find an item in the collection based on PropertyB. It
does not work unless I sort the collection on PropertyB first. If I do this,
then the data the user sees changes. Very bad.
So I guess what I am asking for is a way to search a collection, return the
requested object (index) without disturbing the original data (collection).
Any ideas?
Thanks!
David McCarter
=====================
David McCarter
www.vsdntips.com
contain properties and collections) using IComparer and BinarySearch. I knew
they before doing a search you had to sort your collection, but I found out
the hard way yesterday that it has to be sorted on the same property as you
are searching on. Fine. But now my problem is that while displaying this
collection data to the user I have to search on a different property then the
collection is currently sorted on.
For example, the user has chosen to sort the data on PropertyA. An event
happens and I need to find an item in the collection based on PropertyB. It
does not work unless I sort the collection on PropertyB first. If I do this,
then the data the user sees changes. Very bad.
So I guess what I am asking for is a way to search a collection, return the
requested object (index) without disturbing the original data (collection).
Any ideas?
Thanks!
David McCarter
=====================
David McCarter
www.vsdntips.com