Set an array −
int[] arr = { 23, 66, 96, 110 };Now, create a new list −
var list = new List<int>();
Use the Add method and add the array elements to the list −
for (int i = 0; i < arr.Length; i++) {
list.Add(arr[i]);
}The following is the complete code −
Example
using System;
using System.Collections.Generic;
public class Program {
public static void Main() {
int[] arr = { 23, 66, 96, 110 };
var list = new List<int>();
for (int i = 0; i < arr.Length; i++) {
list.Add(arr[i]);
}
foreach(int res in list) {
Console.WriteLine(res);
}
}
}Output
23 66 96 110