c# transform array into int code example
Example 1: convert string array to int C#
using System;
public class Example
{
public static void Main()
{
string[] strings = new string[] {"1", "2", "3"};
int[] ints = Array.ConvertAll(strings, s => int.Parse(s));
Console.WriteLine(String.Join(",", ints));
}
}
Example 2: convert array object to int[] c#
object[] objarr = new object[] {1,2,3 };
int[] arr = objarr.Cast<int>().ToArray();