微软企业库运用
摘要:添加引用using System.Data.Common;using Microsoft.Practices.EnterpriseLibrary.Data;using Microsoft.Practices.EnterpriseLibrary.Common;//执行数据库操作: Database db = DatabaseFactory.CreateDatabase();//执行存储过程 DbCommand cmd = db.GetStoredProcCommand("存储过程名");//执行Sql语句 DbCommand cmd = db.GetSqlStringCom.
阅读全文
posted @
2013-07-26 22:45
tomfang
阅读(277)
推荐(0)
AbStract 和Interface 方法是否能用Static修饰,为什么?
摘要:Abstract 和Interface 方法是否能用Static修饰,为什么?interface中不能含有Static方法,属性,成员变量。Abstract中可以有Static方法,属性,成员变量。但static前不能用Abstract,Virtual,Overrid进行修饰Static 修饰的方法是不能用this进行访问原因:Static静态方法属于类,不属于任何成员。可以被直接调用,因此不管这个类的实例是否存在,他都会存在。(非静态方法通过类的对象进行销毁)Sleep和wait的区别Sleep()方法是Thread命名空间下的Static方法,将当前线程挂起指定的时间。(指定 System
阅读全文
posted @
2013-07-25 23:18
tomfang
阅读(4298)
推荐(0)
FxCop
摘要:下载地址:http://www.microsoft.com/en-us/download/details.aspx?id=8279FxCop是一个代码分析工具,和StyleCop(代码规范)一起配合使用,是2款非常优秀的编码规范工具。
阅读全文
posted @
2013-07-24 22:25
tomfang
阅读(316)
推荐(0)
StyleCop安装及配置
摘要:HowtomodifythedefaultnewclasstemplateforC#inVisualStudio2008or2010?可参考博客:http://www.rhyous.com/2010/02/17/how-to-modify-the-default-new-class-template-in-visual-studio-2008/http://www.thecodinghumanist.com/Content/HowToEditVSTemplates.aspx1.StyleCop安装网址:http://stylecop.codeplex.com/可下载最新版本实现前系统默认方式:
阅读全文
posted @
2013-07-23 21:20
tomfang
阅读(7444)
推荐(0)
IDispose(), Finalize()
摘要:C#using用法:1.作为指令,用于为命名空间创建别名或导入其他命名空间中定义的类型。(见例1-1)2.作为语句,用于定义一个范围,在此范围的末尾将释放对象。(见例1-2)(例子1-1)① 允许在命名空间中使用类型,这样,您就不必在该命名空间中限定某个类型的使用usingSystem.ServiceModel;② 为命名空间或类型创建别名③ 等同于Try.{}Finally{}在语句结束时自动执行。publicclassFoo:IDisposable2{3publicvoidDispose()4{5Dispose(true);6GC.SuppressFinalize(this);7}89pr
阅读全文
posted @
2013-07-22 00:19
tomfang
阅读(1558)
推荐(0)