Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Once again my self-taught VB.NET skills leave me not knowing the best way to proceed. Hopefully one of you more knowledgeable than me will be able to offer a suggestion.

I have some data that has 4 fields:
Name, PointNumber,  X,     Y
Test1,   10,      345623, 457890
Test1,   20,      345633, 457910
Test1,   30,      345622, 457930
Test1,   40,      345699, 457910
Test1,   50,      345750, 458001
Test32,  100,     345623, 757890
Test32,  200,     345659, 757800
etc.........


I want to be able to sort on the Name, and then these in turn by the PointNumber. Finally I want to be able to linearly interpolate on the pointNumber, so if I have a known Name (say 'Test1') I can calculate what X an Y would be at PointNumber 22.56 etc.

Ignoring the actual interpolation, can anyone suggest what would be the best collection to use to do this?

Perhaps a Sorted List of Key Value pairs? Or perhaps a customised class / property?

Thanks for any suggestions !
Posted
Updated 13-May-14 0:10am
v2

You could create a class, say MyPoint for encapsulating your four fields and then use a List(Of MyPoint). You may then sort it using your own comparer, see List(Of T).Sort Method (IComparer(Of T))[^].
 
Share this answer
 
Comments
codetowns 17-May-14 11:06am    
Many thanks - two good ideas !
Me? I'd create a class holding the four properties, and use a generic List.
Then you can sort with Linq methods:
VB
Dim sorted = myList.OrderBy(Function(m) m.Name).ThenBy(Function(m) m.PointNumber)
 
Share this answer
 
Comments
codetowns 17-May-14 11:06am    
Many thanks - two good ideas !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900