To String Array - CSharp System

CSharp examples for System:Array String

Description

To String Array

Demo Code


using System.Text;
using System.Collections.Generic;
using System;/*from   w w  w  .j av  a 2  s.co  m*/

public class Main{
        public static string[] ToStringArray(Array array)
        {
            string[] newArray = new string[array.Length];

            for (int i = 0; i < array.Length; i++)
            {
                if (array.GetValue(i) == null)
                    newArray[i] = "";
                else
                    newArray[i] = (string)array.GetValue(i).ToString();
            }

            return newArray;
        }
}

Related Tutorials