正文内容加载中...
posted @ 2013-06-25 11:04 gunsmoke 阅读(140) 评论(0) 推荐(0) 编辑
摘要:3. linq group by with a custom classDeclare Custom classpublic class PortableKey{ public Dictionary<string, object> keyBag { get; set; } public PortableKey(Dictionary<string, object> Keys) { this.keyBag = Keys; } public override bool Equals(object obj) { PortableKey o... 阅读全文
posted @ 2012-06-26 07:18 gunsmoke 阅读(147) 评论(0) 推荐(0) 编辑
摘要:1. 使用 DataView// create a dv from the source dtDataView dv = new DataView(dt);// set the output columns array of the destination dtstring[] strColumns = {"NodeID", "Title", "Url"};// true = yes, i need distinct values.dt = dv.ToTable(true, strColumns); 2. 使用linq groupby 阅读全文
posted @ 2012-06-06 12:05 gunsmoke 阅读(138) 评论(0) 推荐(0) 编辑
摘要:DynamicObject & ExpandoObject should be accessed in different way. public static DataTable ToDataTable<T>( IEnumerable<T> input, string tableName) { var dt = new DataTable(); dt.TableName = tableName; if (input == null || !input.Any()) return dt; ... 阅读全文
posted @ 2012-05-15 13:33 gunsmoke 阅读(100) 评论(0) 推荐(0) 编辑
摘要:最近装windows 7时突然遇到一个奇怪的问题。我之前一直用移动硬盘,设成活动分区,然后把 windows 7的ISO解包到移动硬盘的根目录,用它来启动安装 从来没问题。可是装一台没光驱的新电脑时却出现“A required CD/DVD drive device driver is missing. If you have a driver floppy disk, CD, DVD, or USB flash drive, please insert it now.”怎么也跳不过去。在网上找了不少方法,比如用U盘加载主板的SATA驱动啊, 设置不同的启动顺序啊, 把bios中的SATA 从 阅读全文
posted @ 2012-01-10 17:52 gunsmoke 阅读(1775) 评论(0) 推荐(0) 编辑
摘要:正在做的项目里面有需要把DAL 产生的Poco Collection转为DataTable然后交给别的模块处理报表想了一下 写个支持Generic的方法吧, 不过不知道如何判断 T是否是DynamicObject的类型于是取了第一个item,用它来判断一下,这样写肯定不是最好的,把code贴上抛砖引玉。public static DataTable ToDataTable<T>(IEnumerable<T> input, string tableName) { var dt = new DataTable(); dt.TableName... 阅读全文
posted @ 2011-10-20 12:14 gunsmoke 阅读(449) 评论(0) 推荐(0) 编辑