在C#中,定义一个空列表有多种方法。下面是其中的几种方法:
List<T> myList = new List<T>();
List<T> myList = new List<T> { };
var myList = new List<T>();
其中,T是要存储在列表中的元素的类型,例如int、string等。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:c# list.contains 的边界条件测试有哪些