I have a list of strings, and these strings contain numbers and words.
What I wanted to do is order it by the numbers (numeric order) followed by the words (alphabet
This solution attempts parsing once for each value.
List voltage = new List() { "1", "5", "500" , "LT", "RT", "400" }; List result = voltage .OrderBy(s => { int i = 0; return int.TryParse(s, out i) ? i : int.MaxValue; }) .ThenBy(s => s) .ToList();