随笔分类 - C#
摘要:string strLabelNum = "lab_" + iNum.ToString();Control[] cLabel = pnl.Controls.Find(strLabelNum, true);Label lblTop = (Label)cLabel[0];lblTop.Left = pnl.Width / 2 - 5;lblTop.Top = pnl.Height / 2 - 5;lblTop.Text = Convert.ToString(picnum.iPageFirstNum + iNum - 1);lblTop.BringToFront(); lblTo
阅读全文
摘要:反射是一个程序集发现及运行的过程,通过反射可以得到*.exe或*.dll等程序集内部的信息。使用反射可以看到一个程序集内部的接口、类、方法、字段、属性、特性等等信息。在System.Reflection命名空间内包含多个反射常用的类,下面表格列出了常用的几个类。类型作用Assembly通过此类可以加载操纵一个程序集,并获取程序集内部信息EventInfo该类保存给定的事件信息FieldInfo该类保存给定的字段信息MethodInfo该类保存给定的方法信息MemberInfo该类是一个基类,它定义了EventInfo、FieldInfo、MethodInfo、PropertyInfo的多个公用
阅读全文
摘要:引言 本文主要从线程的基础用法,CLR线程池当中工作者线程与I/O线程的开发,并行操作PLINQ等多个方面介绍多线程的开发。 其中委托的BeginInvoke方法以及回调函数最为常用。 而 I/O线程可能容易遭到大家的忽略,其实在开发多线程系统,更应该多留意I/O线 程的操作。特别是在ASP.NET开发当中,可能更多人只会留意在客户端使用Ajax或者在服务器端使用UpdatePanel...
阅读全文
摘要:public string Execute(string dosCommand, int milliseconds) { string output = ""; //输出字符串 if (dosCommand != null && dosCommand != "") { Process process = new Process(); //创建进程对象 ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "cmd.exe";
阅读全文
摘要://1.using System.Runtime.InteropServices;//2.import kernel32.dll[DllImport("kernel32.dll",EntryPoint = "LCMapStringA")] public static extern int LCMapString(int Locale,int dwMapFlags,byte[] lpSrcStr,int cchSrc,byte[] lpDestStr,int cchDest); const int LCMAP_SIMPLIFIED_CHINESE = 0x
阅读全文