I want to sort a list of custom objects by object property numerical values.
For example, I have custom object MyObject with properties:
MyObject.A
MyObject.B
MyObject.C
Where A is a string containing number values, B and C are Strings containing text.
I want to sort the list containing these objects by the A property from smallest number to largest.
I tried using this:
MyList = MyList.OrderBy(Function(i) i.A).ToList()
But this sorts the list as if the numbers were strings.
For example, I get the result: 1,10,11,2,3,4.
What I actually wanted was this: 1,2,3,4,10,11
How can I sort the list by numerical values?