Code 1.
using System; using ; using ; using ; using ; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { List<int> list1 = new List<int> { 1, 2, 3, 4, 5, }; } } }
Code 2.
using System; using ; using ; using ; using ; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { List<int> list1 = new List<int>(); (1); (2); (3); (4); (5); } } }
The above are the two methods of initializing list<>. I hope everyone will support me in the future.