![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | sorting an iList help I'm trying to figure out how to sort an iList in vb.net. Say i have a collection that looks like Private mvcLastName As String = Nothing Private mvcFirstName As String = Nothing Public Property LastName() As String Get Return mvcLastName End Get Set(ByVal pvalue As String) mvcLastName = pvalue End Set End Property Public Property FirstName() As String Get Return mvcFirstName End Get Set(ByVal pvalue As String) mvcFirstName = pvalue End Set End Property I'd like to know how to sort it by the property firstname or lastname and either asc or desc. I've been looking around... but not able to get it figured out. thanks hope someone can lend a hand |
My System Specs![]() |
| | #2 (permalink) |
| | Re: sorting an iList help Hi, You can start here, http://msdn.microsoft.com/en-us/libr...ctionbase.aspx As it is about sorting then it is mostly easier to use a class build for data. For sorting anything else you need to implement the Icomparer interface http://msdn.microsoft.com/en-us/libr...icomparer.aspx Beside that you can use as well a generic list and generic Icomparer class, because your properties have to be used as object in the non generic lists. Sorting is something I don't like in Net as it is done in my idea in an elite way. This is especially when it is about more value types in one sort. (For you it is not so difficult as you have a only strings) A better place to ask this question is however microsoft.public.dotnet.languages.vb Cor "jvcoach23" <jvcoach23@xxxxxx> wrote in message news:B77A6248-2370-48A5-BC18-71292B9915F5@xxxxxx Quote: > I'm trying to figure out how to sort an iList in vb.net. Say i have a > collection that looks like > Private mvcLastName As String = Nothing > Private mvcFirstName As String = Nothing > Public Property LastName() As String > Get > Return mvcLastName > End Get > Set(ByVal pvalue As String) > mvcLastName = pvalue > End Set > End Property > Public Property FirstName() As String > Get > Return mvcFirstName > End Get > Set(ByVal pvalue As String) > mvcFirstName = pvalue > End Set > End Property > > I'd like to know how to sort it by the property firstname or lastname and > either asc or desc. I've been looking around... but not able to get it > figured out. > > thanks > hope someone can lend a hand |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Sorting | Vista mail | |||
| RE: Sorting XML | PowerShell | |||
| Sorting | Live Mail | |||
| Sorting (again) | PowerShell | |||