Convert array from string to int c#

Code examples

4
0

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));
	}
}
1
0

convert array from string to int c#

string[] strings = new string[] {"1", "55", "3"}

int[] asIntegers = Array.ConvertAll(strings, int.Parse);

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................