C# Program to convert integer array to string array


Use the ConvertAll method to convert integer array to string array.

Set an integer array −

int[] intArray = new int[5];

// Integer array with 5 elements
intArray[0] = 15;
intArray[1] = 30;
intArray[2] = 44;
intArray[3] = 50;
intArray[4] = 66;

Now use Array.ConvertAll() method to convert integer array to string array −

Array.ConvertAll(intArray, ele => ele.ToString());

Let us see the complete code −

Example

 Live Demo

using System;
using System.Text;
public class Demo {
   public static void Main() {
      int[] intArray = new int[5];
      // Integer array with 5 elements
      intArray[0] = 15;
      intArray[1] = 30;
      intArray[2] = 44;
      intArray[3] = 50;
      intArray[4] = 66;
      string[] strArray = Array.ConvertAll(intArray, ele => ele.ToString());
      Console.WriteLine(string.Join("|", strArray));
   }
}

Output

15|30|44|50|66

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 22-Jun-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements