Duyệt mảng và List.Add từng phần tử để chuyển sang List<T>.
Ví dụ
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
int[] arr = { 23, 66, 96, 110 };
var list = new List();
for (int i = 0; i < arr.Length; i++)
list.Add(arr[i]);
foreach (int res in list)
Console.WriteLine(res);
}
}
Kết quả
23 66 96 110
Cách ngắn gọn: var list = new List hoặc arr.ToList() (cần using System.Linq;).