CSharp - Converting an Array of Strings to Integers

Description

Converting an Array of Strings to Integers

Demo

using System;  
using System.Linq;  
class Program//from   w  w  w . jav a 2 s.  c  o m
{
    static void Main(string[] args)
    {
        string[] numbers = { "0042", "010", "9", "27" };  
        int[] nums = numbers.Select(s => Int32.Parse(s)).ToArray();  
        foreach(int num in nums)  
          Console.WriteLine(num);  
              
    }
}

Result

Related Example