I’m not really sure if what i’m looking for actually exists, so maybe you guys can help out.
I have the below data:
Apples|3211|12
Markers|221|9
Turtle|1023123123|22
The first column is always a string, the second column and third column are ints. However, what I want to do is be able to reference theses as strings or ints, and then be able to sort via the third column asc. Any ideas?
Something like MyTable[i].Column[i] and in this case MyTable[1].Column[2] would produce 12 as a int (because it’s ordered).
If you want type safety you will need to create a class that holds each record:
Afterwards store them in a generic List<>, then you can order them, as you like:
UPDATE
Since it was requested I customized the answer from JustinNiessner to fit to my example:
This can be optimized by using
varand not executingToList()on the list, but is done this way in order to keep it simple for you to understand the concepts better.