Converting an Array of Strings to Integers and Sorting It
using System;
using System.Linq;
public class MainClass {
public static void Main() {
string[] numbers = { "0042", "010", "9", "2q7" };
int[] nums = numbers.Select(s => Int32.Parse(s)).OrderBy(s => s).ToArray();
foreach (int num in nums)
Console.WriteLine(num);
}
}
Related examples in the same category