linq convert string array to int array 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 string array to integer python

desired_array = [int(numeric_string) for numeric_string in current_array]

Example 3: convert int array to integer list java

int[] arr = {1,2,3};
IntStream.of(arr).boxed().collect(Collectors.toList());