通过本文主要向大家介绍了等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
代码一、
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { List<int> list1 = new List<int> { 1, 2, 3, 4, 5, }; } } }</div>
代码二、
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { List<int> list1 = new List<int>(); list1.Add(1); list1.Add(2); list1.Add(3); list1.Add(4); list1.Add(5); } } }</div>
以上就是list<>初始化的两种方法,希望大家以后多多支持。
</div>