Convert an Array of Strings to Integers in CSharp
Description
The following code shows how to convert an Array of Strings to Integers.
Example
//from w w w .ja va 2 s .c o m
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)).ToArray();
foreach(var n in nums){
Console.WriteLine(n);
}
}
}