Stopwatch类:

提供一组方法和属性,可用于准确地测量运行时间

 

Stopwatch myWatch = new Stopwatch();

myWatch.Start();

代码段

myWatch.Stop();

Text1Box.Text="运行时间 " +  myWatch.ElapsedMilliseconds.ToString() + " ms";

 

 

读取数据库联接字段

ConnectionStringSettings myConnectionSettings = ConfigurationManager.ConnectionStrings[myconnectionstr];

使用ConfigurationManager时必须将System.configuration库引用而不能只简单的使用using

 

20提供了一个DbProviderFactory的工厂类,使用前需 using System.Data.Common;

 

关键字partial 2.0新提供的。可以将代码拆分到多个文件

 

 

通过工程中的Settings.settings来设置属性值,在代码中通过

Properties.Settings.Default.mysettingstr来读取属性值

Properties.Settings.Default.Save();来保存属性值

这样可以实现代码与设置的分离。数据存储在user.config.xml文件

 

 

 

相关文章:

  • 2021-06-01
  • 2021-07-04
  • 2022-02-10
  • 2021-12-06
  • 2021-10-02
  • 2021-09-28
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2021-05-22
  • 2022-01-24
  • 2021-10-02
相关资源
相似解决方案