list<>初始化赋值两种方式

1,初始化直接赋值

List<string> unlocList = new List<string>
{
"CNNKG",
"CNSHH-CNSHA-CNSGH",
"USLAX-USLGB"
};

2,list.add()的方式

List<string> unlocList = new List<string>();

unlocList .Add("CNNKG");

unlocList .Add("CNSHH-CNSHA-CNSGH");

unlocList .Add("USLAX-USLGB");

原文地址:https://www.cnblogs.com/katrina-leng/p/10830463.html