随笔分类 - .NET基础
委托用法
摘要:一、委托callback 回调函数声明委托:(与声明类相似)public delegate string MyDelegate(string sInput);使用委托:1.MyDelegate myDelegateCase = new MyDelegate(InvokeMethod);private string InvokeMethod(string sInput){ return sInput);}2. 委托推断MyDelegate myDelegateCase = InvokeMethod;3. 匿名方法MyDelegate myDelegateCase = delegate(strin
阅读全文
posted @ 2011-04-07 21:54
huadust
注册表操作
摘要:1.读取指定名称的注册表的值private string GetRegistData(string name){ string registData; RegistryKey hkml = Registry.LocalMachine; RegistryKey software = hkml.OpenSubKey("SOFTWARE",true); RegistryKey aimdir = software.OpenSubKey("XXX",true); registData = aimdir.GetValue(name).ToString(); retu
阅读全文
posted @ 2011-04-07 21:35
huadust
DateTime各种用法
摘要:1、DateTime 数字型System.DateTime currentTime=new System.DateTime();1.1 取当前年月日时分秒currentTime=System.DateTime.Now;1.2 取当前年int 年=currentTime.Year;1.3 取当前月int 月=currentTime.Month;1.4 取当前日int 日=currentTime.Day;1.5 取当前时int 时=currentTime.Hour;1.6 取当前分int 分=currentTime.Minute;1.7 取当前秒int 秒=currentTime.Second;1
阅读全文
posted @ 2011-04-05 19:49
huadust
用DataTable构建树
摘要:3publicvoidAddTree(intParentID,TreeNodepNode)4{5DataViewdvTree=newDataView(ds.Tables[0]);6dvTree.RowFilter="[PARENTID]="+ParentID;7foreach(DataRowViewRowindvTree)8{9if(pNode==null)10{11TreeNodeNode=treeView1.Nodes.Add(Row["ConText"].ToString());12AddTree(Int32.Parse(Row["ID&
阅读全文
posted @ 2011-04-05 17:41
huadust
Lock Review
摘要:lock 将{语句块}标记为{临界区},方法是获取给定对象的互斥锁,执行语句,然后释放该锁。当一个互斥锁被占用时,在同一个线程中执行的代码仍可以获取和释放该锁;但是,在其他线程中执行的代码在该锁被释放前是无法获取的。下面二种方式完全等效:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHi...
阅读全文
String Review
摘要:[代码]Result is:123456HelloHelloActual:[代码]Result is the same.
阅读全文
Class Review
摘要:1. definition[代码]2. inherit[代码]3. MembersConstructorDestructor不能在结构中定义析构函数。只能对类使用析构函数; 一个类只能有一个析构函数; 无法继承或重载析构函数; 无法调用析构函数。它们是被自动调用的; 析构函数既没有修饰符,也没有参数. 程序员无法控制何时调用析构函数,因为这是由垃圾回收器决定的。垃圾回收器检查是否存在应用程序不再使...
阅读全文
posted @ 2009-07-21 15:14
huadust
DataTable opertion
摘要:1. Definition[代码]2. Add data[代码]3. TBC
阅读全文
2008_10_29_星期三
摘要:今天早上骑车来公司的时候下小雨了,不大,无风。上午准备把Url中含有中文参数时,用 Uri.AbsoluteUri 取Url的连接时,它会自动把Url中的汉字进行UTF-8编码成类似%A1A2A3的形式,再对这个绝对 Url 转码后就造成了有的 Url 不能访问,(正常应该是对原Url 进行 ASCII编码)这个问题困惑好久,怎么 Uri.AbsoluteUri 取得的Url 就不能访问。最后还是...
阅读全文
2008_10_27_星期一
摘要:今天的天气真不错,比昨天好多了,风也不大。今天主要完成昨天那些未完成的工作。下面是今天查到的一些比较有用的资料:1. 读取Excel文件: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- DataSetdsTaskList=newDataSet();...
阅读全文
浙公网安备 33010602011771号