You can construct a Sorted List using your own IComparer, and then that can look inside the objects to determine the sort order on insert.
Kirk -----Original Message----- From: Bill Conroy [mailto:[EMAIL PROTECTED]] Sent: Friday, 24 May 2002 4:19 a.m. To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Hashtables and structs I would suggest takign a look at System.Collections.SortedList. I found it to be quite useful for something like this. In my scenario the keys were what I was sorting on. If you can use the key as the field you need for sorting then you are set. As for an entry in a field of the data being stored you will have to search over every item for this since they won't be sorted then. -Bill Conroy On Thu, 23 May 2002 08:23:47 -0700, Greg Gates <[EMAIL PROTECTED]> wrote: >Hello everyone: > >I have two basic questions regarding hashtables and structs. > >1) Is there any point in using a struct if the struct contains a >string, given that a string is a reference type? > >2) What is the most efficent way to sort and filter a hashtable in >.NET. For example, if I have a hashtable that contains the following >key/values: > >A,object1 >B,object2 >C,object3 > >object1 has a foo field with a value of 4 >object2 has a foo field with a value of 1 >object3 has a foo field with a value of 2 > >What is the quickest way to retrieve an ordered subset of the items >where the foo field is less than or equal to 3? > >thanks, Greg > >You can read messages from the DOTNET archive, unsubscribe from DOTNET, >or subscribe to other DevelopMentor lists at >http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.