|
-
Jun 15th, 2018, 03:29 PM
#1
Thread Starter
Member
Sorting LIST(OF STRUCTURE) by two variables
Hi All, thanks for any help given in advanced!
I have a structure called MyStructure as below:
Public Structure MyStructure
Public Value1 As Integer
Public Value2 As Integer
End Structure
I also have a list of(MyStructure):
Public People_list As New List(Of MyStructure)
After adding data to the structure, i now want to sort it first by Value1 in ascending order, and then by Value2 in ascending order aswell.
So..
1, 4
2, 3
2, 1
2, 7
1, 3
Becomes...
1, 3
1, 4
2, 1
2, 3
2, 7
I beleive this can be done with IComparable??
Thanks very much,
Simon
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|