4. C#计算代码运行时间
- //导入该命名空间 using System.Diagnostice;
- Stopwatch watch=new Stopwatch (); watch.Start();
- /* 此处为要计算的运行代码
- */ watch.Stop();
- //获取当前实例测量得出的总运行时间(以毫秒为单位) string time = watch.ElapsedMilliseconds.ToString();
5. C#根据日期获取星期方法
- protected void Page_Load(object sender, EventArgs e) {
- int m = System.DateTime.Today.Month; int y = System.DateTime.Today.Year;










