C#集合利用System.Linq.Enumerable.Select()方法执行集合类型转换

将List<dynamic>集合中的guid转换为强类型的Guid

string authorsJson=[{"guid":"e1a2c42d-9337-415a-b578-04ad37bf78cd","name":"宁飞"},{"guid":"fb069796-94b8-429b-aa57-cac7803c6da1","name":"陈小丽"},{"guid":"e79f5247-95e5-47c4-862c-52c283e1be49","name":"李雪源"},{"guid":"695ae4d8-4c59-46e5-b995-65f526632165","name":"刘真志"}]
var authorsDynaList = Sys_General.GetObjct<List<dynamic>>(model.authors);
//作者guid主键强类型Guid集合
var authorslist = authorsDynaList.Select<dynamic, Guid>(x => Guid.Parse(x.guid.Value)).ToList();

 

上一篇:Wix 快速开发安装包程序 (一)5分钟构建一个最轻量的安装包程序


下一篇:跨 Appdomain 数据共享