其他分享
首页 > 其他分享> > List集合里添加数据

List集合里添加数据

作者:互联网

List<User>?users=?new?List<User>();
users.Add(new?User{ID=1,Name="王老师",Pwd=1});
users.Add(new?User{ID=2,Name="李老师",Pwd=1});
users.Add(new?User{ID=3,Name="马老师",Pwd=1});

List<User> users = new List<User>{
new User {ID = 1, Name = "王老师", Pwd = 1 },
new User { ID = 2, Name = "李老师", Pwd = 1 },
new User { ID = 3, Name = "马老师", Pwd = 1 }
};

标签:Name,List,Pwd,添加,User,集合,new,ID,users
来源: https://www.cnblogs.com/canfengfeixue/p/16638258.html