代码一、
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, }; } } }
代码二、
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); } } }
以上就是list<>初始化的两种方法,希望大家以后多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论