随笔分类 -  C#

摘要:经常使用CSVDE DSADD工具批量修改导入汇出AD账号,一直对userAccountControl的详细含义不是很清楚,userAccountControl记录了用户的AD账号的很多属性信息,是一组16进制数?该属性标志是累积性的。若要禁用用户的帐户,请将UserAccountControl属性... 阅读全文
posted @ 2014-12-25 14:48 自然去留 阅读(2332) 评论(0) 推荐(0)
摘要:1、创建项目,添加新项,名称处填写Messages.tt,如下图:添加后,Messages.tt文件内容如下:1 2 2、创建一个实体对象MessageEntry,用以传递模版信息,具体代码如下: 1 public class MessageEntry 2 { 3 p... 阅读全文
posted @ 2014-09-09 14:09 自然去留 阅读(215) 评论(0) 推荐(0)
摘要:1、链接配置 1 2 3 4 NHibernate.Connection.DriverConnectionProvider 5 NHibernate.Driver.SqlClientDriver 6 Server=.;initial ca... 阅读全文
posted @ 2014-09-08 11:21 自然去留 阅读(225) 评论(0) 推荐(0)
摘要:1 using System.Text; 2 using System.Runtime.InteropServices; 3 using System; 4 5 namespace Benson.INI读写 6 { 7 #region INI结构介绍 8 /**... 阅读全文
posted @ 2014-08-11 18:04 自然去留 阅读(245) 评论(0) 推荐(0)
摘要:#region 查找与指定文件关联在一起的程序的文件名 /// /// 查找与指定文件关联在一起的程序的文件名 /// /// 窗口句柄 /// 指定字串“open”来打开lpFlie文档,或指定“Print”来打... 阅读全文
posted @ 2014-08-11 13:33 自然去留 阅读(474) 评论(0) 推荐(0)
摘要:AOP(面向方面编程,是Aspect Oriented Programming的缩写)OOP(面向对象编程,是Object Oriented Programming的缩写)OOD(面向对象设计,是Object Oriented Design的缩写)OOA(面向对象分析方法,是Object-Orien... 阅读全文
posted @ 2014-07-11 15:18 自然去留 阅读(445) 评论(0) 推荐(0)
摘要:string str = this.textBox1.Text; Regex regex = new Regex("0[xX][0-9a-fA-F]{2,5}"); MatchCollection mc = regex.Matches(str); foreach (Match m in mc) ... 阅读全文
posted @ 2014-06-30 17:41 自然去留 阅读(931) 评论(0) 推荐(0)
摘要:1 class controlIme 2 { 3 //声明一些API函数 4 [DllImport("imm32.dll")] 5 public static extern IntPtr ImmGetContext(IntPtr Hwnd);... 阅读全文
posted @ 2014-04-11 10:21 自然去留 阅读(249) 评论(0) 推荐(0)
摘要:要把软件做得非常灵活又要便于维护是一个很困难的事情。灵活的软件他的结构就复杂,维护起来就困难。有得必有失,关键就在于如何处理这两者,使得大于失。软件的设计开发应遵循以下六大原则: 1. OCP 全称:“Open-Closed Principle” 开放-封闭原则 说明:对扩展开放,对修改关闭。 优点... 阅读全文
posted @ 2014-03-31 17:47 自然去留 阅读(182) 评论(0) 推荐(0)
摘要:1 /// 2 /// 文件分割方法 3 /// 4 /// 要分割的文件 5 /// 目标目录 6 /// 分割后的小文件名 7 public void SplitFile(str... 阅读全文
posted @ 2013-10-21 21:23 自然去留 阅读(278) 评论(0) 推荐(0)
摘要:1 public class CustomDataContext : System.Data.Linq.DataContext 2 where TEntity : class,new() 3 { 4 public CustomDataContext(... 阅读全文
posted @ 2013-08-15 17:58 自然去留 阅读(185) 评论(0) 推荐(0)
摘要:1 public class ChnToPh 2 { 3 //定义拼音区编码数组 4 private static int[] getValue = new int[] 5 { 6 -20319,-20317,-20304,-20... 阅读全文
posted @ 2013-08-06 10:35 自然去留 阅读(479) 评论(0) 推荐(0)
摘要:/// 〈summary〉 /// 汉字转拼音缩写 /// 〈/summary〉 /// 〈param name="str"〉要转换的汉字字符串〈/param〉 /// 〈returns〉拼音缩写〈/returns〉 public string GetPYString(string str) { ... 阅读全文
posted @ 2013-08-06 10:05 自然去留 阅读(728) 评论(0) 推荐(0)
摘要:1 public static void ExportToExcel(DataSet source, string fileName) 2 { 3 System.IO.StreamWriter excelDoc = new System... 阅读全文
posted @ 2013-07-28 10:15 自然去留 阅读(316) 评论(0) 推荐(0)
摘要:1 public class ChineseCalendarException : Exception2 {3 public ChineseCalendarException(string msg)4 : base(msg)5 ... 阅读全文
posted @ 2013-07-21 16:46 自然去留 阅读(552) 评论(0) 推荐(0)
摘要:public string getCpuInfo() //读取CPU信息 { ManagementClass mobj = new ManagementClass("Win32_Processor"); ManagementO... 阅读全文
posted @ 2013-06-30 21:28 自然去留 阅读(288) 评论(0) 推荐(0)
摘要:引用命名空间:using System.Net;//网络功能 using System.IO;//流支持using System.Threading;//线程支持定义线程下载主体: 1 public class threadbody 2 { 3 Progra... 阅读全文
posted @ 2013-06-21 12:34 自然去留 阅读(516) 评论(0) 推荐(0)
摘要:先看下效果:以下是窗体代码:public partial class Form1 : Form { public Form1() { InitializeComponent(); } string strg;//数据... 阅读全文
posted @ 2013-06-06 14:12 自然去留 阅读(672) 评论(0) 推荐(0)
摘要://调用动态链接库gdi32.dll [ System.Runtime.InteropServices.DllImportAttribute ( "gdi32.dll" ) ] private static extern bool BitBlt ( IntPtr hd... 阅读全文
posted @ 2013-04-23 21:16 自然去留 阅读(129) 评论(0) 推荐(0)
摘要:一 Memcached服务器端的安装 (此处将其作为系统服务安装) 下载文件:memcached 1.2.1 for Win32 binaries (Dec 23, 2006) 1 解压缩文件到c:\memcached 2 命令行输入 'c:\memcached\memcached.exe -d i... 阅读全文
posted @ 2013-04-16 20:11 自然去留 阅读(445) 评论(0) 推荐(0)