摘要:public static void BackupSQLServerDB(string connectionString, string backupPath) { using (SqlConnection conn = new SqlConnection(connectionString)) { //string sql = "use master;backup database " + conn.Database + " to disk='" + backupPath + "'"; string sql = &qu
阅读全文
摘要:SkipListSkipListNode /// <summary> /// Represents a node in a SkipList. A SkipListNode has a Height and a set of neighboring /// SkipListNodes (precisely as many neighbor references as its Height, although some neighbor /// references may be null). Also, a SkipListNode contains some piece of d
阅读全文
摘要:/// <summary> /// 渐变算法 /// </summary> /// <param name="sourceImg">位图源(物理路径)</param> /// <param name="colorHead">起点色(HTML格式)</param> /// <param name="colorTail">终点色(HTML格式)</param> /// <param name="imgPath">
阅读全文
摘要:public static DbCommand AddInParameter(this DbCommand cmd, string parameterName, object value) { DbParameter para = cmd.CreateParameter(); para.ParameterName = parameterName; para.Value = value ?? DBNull.Value; cmd.Parameters.Add(para); return cmd; } public static DbCommand AddInParameter(this DbCom
阅读全文
摘要:public static void SetNoCache() { HttpContext context = HttpContext.Current; context.Response.Buffer = true; context.Response.Charset = "gb2312"; context.Response.ContentType = "text/plain"; context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); context.Response.Cache.SetEx
阅读全文
摘要:NodeGraphNode /// <summary> /// Represents a node in a graph. A graph node contains some piece of data, along with a set of /// neighbors. There can be an optional cost between a graph node and each of its neighbors. /// </summary> /// <typeparam name="T">The type of data
阅读全文
摘要:/// <summary> /// SpinWait只有在SMP或多核CPU下才具有使用意义。在单处理器下,旋转非常浪费CPU时间,没有任何意义。 /// 自旋锁特性导致其比较适用一些轻量级,极短时间的多核cpu系统上的锁保护。 /// </summary> public struct SpinWait { public static readonly bool IsSingleProcessor; private const int yieldFrequency = 4000; private const int yieldOneFrequency = 3 * yie
阅读全文