摘要: 支持 info.A.B.C 这样的排序表达式 /// <summary> /// 在 linq 查询中使用字符串表达式进行排序 /// </summary> public static class OrderByStringExpressionExtensions { public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property) { return ApplyOrder<T>(source, property 阅读全文
posted @ 2011-04-14 19:04 梦幻泡影 阅读(691) 评论(0) 推荐(0)
摘要: namespace ExtensionMethods{ using System; using System.Collections.Generic; using System.Linq; public static class IEnumerableExtensions { /// <summary> /// Invokes a transform function on each element of a sequence and returns the minimum Double value /// if the sequence is not empty; otherwi 阅读全文
posted @ 2011-04-14 18:51 梦幻泡影 阅读(529) 评论(2) 推荐(0)
摘要: select id from infoid-----------123567810111215(11 行受影响)方法一:select (select max(id)+1 from Info where id<a.id) as beginId,(id-1) as endIdfrom Info awherea.id>(select max(id)+1 from Info where id<a.id)beginId endId----------- -----------4 49 913 14(3 行受影响)方法二:select beginId,(select min(id)-1 阅读全文
posted @ 2011-04-14 18:40 梦幻泡影 阅读(541) 评论(1) 推荐(0)
摘要: 摘自 http://www.cnblogs.com/ejiyuan/archive/2009/07/20/1527224.html[代码] 阅读全文
posted @ 2011-04-14 17:03 梦幻泡影 阅读(341) 评论(0) 推荐(0)
摘要: ///<summary> /// equiv of PHP's var dump for an object’s properties because i cbf writing all the properties out. ///</summary> ///<param name="info"></param> private static string var_dump(object info) { StringBuilder sb = new StringBuilder(); Type t = info.Get 阅读全文
posted @ 2011-04-14 16:59 梦幻泡影 阅读(1594) 评论(0) 推荐(0)
摘要: 出处:http://blogs.thesitedoctor.co.uk/tim/2010/02/27/Collapse+All+Solution+Explorer+Items+In+Visual+Studio+2010.aspxImports SystemImports EnvDTEImports EnvDTE80Imports EnvDTE90Imports System.Diagnostics'-----------------------------------------------------------' CollapseAll Module'------- 阅读全文
posted @ 2011-04-14 16:42 梦幻泡影 阅读(699) 评论(0) 推荐(0)
摘要: public class ExportDataGirdViewToExcel { /// <summary> /// 将DataGirdView数据,导出EXCEL文件。需要下载 MyXls。 /// 代码摘自 http://topic.csdn.net/u/20101231/09/039bdd22-3f0a-4bbb-908e-d887b4d7bbfe.html?19933 /// </summary> /// <param name="dgv">DataGridView控件名称</param> /// <param 阅读全文
posted @ 2011-04-14 16:27 梦幻泡影 阅读(693) 评论(0) 推荐(0)
摘要: public static class ProtectConfigFileUtil{ /// <summary> /// 加密配置节示例,加密 ConnectionStrings 和 AppSettings /// </summary> [Obsolete("这个方法只是示例")] public static void ProtectConnectionStringsAndAppSettings(HttpContext context) { Configuration config = WebConfigurationManager.OpenWebC 阅读全文
posted @ 2011-04-14 08:11 梦幻泡影 阅读(297) 评论(0) 推荐(0)
摘要: /// <summary> /// Form1 的构造函数 /// </summary> public Form1() { InitializeComponent(); this.Left = Screen.PrimaryScreen.WorkingArea.Right - this.Width; this.Top = Screen.PrimaryScreen.WorkingArea.Bottom - this.Height; } 阅读全文
posted @ 2011-04-14 07:52 梦幻泡影 阅读(732) 评论(1) 推荐(0)