国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Linq 實現兩個對象實例List之間的賦值

2019-11-17 02:07:56
字體:
來源:轉載
供稿:網友

Linq 實現兩個對象實例List之間的賦值

 1 public class UserCopy 2 { 3     public class LoginEntity 4     { 5         public string UserName { get; set; } 6         public string UserPwd { get; set; } 7         public DateTime ActiveTime { get; set; } 8     } 9 10     public class UserEntity : LoginEntity11     {12         public string UserID { get; set; }13         public Int16 UserSex { get; set; }14         public Int32 UserAge { get; set; }15     }16 17     PRotected void UserCopy()18     {19         List<UserEntity> userList = new List<UserEntity>() { 20             new UserEntity(){21             UserID="U1",22             UserName="U1",23             UserPwd="U1PWD",24             ActiveTime=DateTime.Now25             },26             new UserEntity(){27             UserID="U2",28             UserName="U2",29             UserPwd="U2PWD",30             ActiveTime=DateTime.Now},31             new UserEntity(){32             UserID="U2",33             UserName="U2",34             UserPwd="U2PWD",35             ActiveTime=DateTime.Now}36             };37 38         List<LoginEntity> loginList = new List<LoginEntity>();39         //關鍵代碼:遍歷賦值40         userList.ForEach(user => loginList.Add(new LoginEntity()41         {42             UserName = user.UserName,43             UserPwd = user.UserPwd,44             ActiveTime = user.ActiveTime45         }));46     }47 }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 普兰县| 聂拉木县| 屏东县| 手游| 习水县| 博白县| 临高县| 中江县| 拜城县| 安多县| 潜江市| 甘泉县| 鹰潭市| 镇原县| 商水县| 昌图县| 许昌市| 尼玛县| 汾阳市| 神池县| 雷波县| 两当县| 蓝田县| 彭泽县| 丹凤县| 屏南县| 海原县| 德昌县| 和龙市| 盐边县| 历史| 博爱县| 安阳县| 宁陕县| 钦州市| 健康| 江阴市| 巩义市| 乐都县| 稻城县| 保康县|