计算方法执行时间

//Stopwatch WatchAll2 = new Stopwatch();  //测量代码执行时间
                //WatchAll2.Start();     //开始
                ////----------------------------------------------------------->
//调用方法
//WatchAll2.Stop();      //结束
               LogHelper.WriteError(string.Format("[融券卖出数据库提交动作]获取*所需要保证金*用时{0}毫秒", WatchAll2.ElapsedMilliseconds.ToString()), null);
原文地址:https://www.cnblogs.com/ylemzhang/p/2949436.html