I receive an array which I'm not in control of. Sadly, it comes through as a string although all values are always int values.
There is no option to change the array so I have to work with it.
I'd like to sort them but of course, "10" (as a string) comes before "4" (as a string). I understand why.
Without converting the values of the array to int values, is there a way to order the strings as if they were int? I know converting is a better way, but curious as to the option when using string.
In this example, there will not be negative values
My array could be
"10"
"11"
"2"
"4"
but I'd like to show it as
"2"
"4"
"10"
"11"
ints?strings.OrderBy(int.Parse)would be the obvious way to do it.