Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Converting String array to List in C#

The following code explains the conversion of string array to List and printing the values.

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;

namespace forgetCode
{
    class program
    {
        public static void Main()
        {
            string [] array = { "hi","welcome", "to", "forget code"};
            List<string> list = array.ToList();
            foreach (string item in list)
            {
                Console.WriteLine(item);
            }
        }
    }
}


Output:

hi
welcome
to
forget code