Introducing Radical.sh

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

Converting Integer array to List in C#

The following code explains the conversion of integer array to list and printing the vales.

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

namespace forgetCode
{
    class program
    {
        public static void Main()
        {
            int[] array = { 1, 2, 3, 4, 5 };
            List<int> list = array.ToList();
            foreach (int i in list)
            {
                Console.WriteLine(i);
            }
        }
    }
}


Output:
1
2
3
4
5