C#超实用代码段合集

2019-12-26 14:08:43王振洲
  • "Zhuang","Zhui","Zhun","Zhuo","Zi","Zong","Zou","Zu","Zuan","Zui","Zun","Zuo"  }; 

    4. C#计算代码运行时间

     

     
    1. //导入该命名空间  using System.Diagnostice; 
    2. Stopwatch watch=new Stopwatch ();  watch.Start(); 
    3. /*  此处为要计算的运行代码 
    4. */  watch.Stop(); 
    5. //获取当前实例测量得出的总运行时间(以毫秒为单位)  string time = watch.ElapsedMilliseconds.ToString(); 

    5. C#根据日期获取星期方法

     

     
    1. protected void Page_Load(object sender, EventArgs e)  { 
    2. int m = System.DateTime.Today.Month;  int y = System.DateTime.Today.Year;