C# List集合字段转换为List<string>集合

定义类:

public class Student

{

    public string Name{get;set;}

}

 

定义List集合数据:

List<Student> stuList = new List<Student>();

stuList .add(new Student(){Name="a1"});

stuList .add(new Student(){Name="a2"});

 

定义接收的List<string> 字符串集合:

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

vList =stuList.Select(t => t.Name).ToArray();

posted @ 2021-08-13 11:41  黑暗时代地表人  阅读(872)  评论(0编辑  收藏  举报