using System.Diagnostics;

namespace Edu.Common.Plugin
{
    /// <summary>
    /// 函数执行时间帮助类
    /// </summary>
    public class StopwatchHelper
    {
        private Stopwatch Stopwatch { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        public StopwatchHelper()
        {
            Stopwatch = new Stopwatch();
        }

        /// <summary>
        /// 开始方法
        /// </summary>
        public void Start()
        {
            Stopwatch.Start();
        }

        /// <summary>
        /// 结束方法
        /// </summary>
        /// <returns></returns>

        public string Stop()
        {
            Stopwatch.Stop();
            string time= Stopwatch.ElapsedMilliseconds.ToString();
            Stopwatch.Reset();
            return time;
        }
    }
}
