using System.Diagnostics; Stopwatch st = new Stopwatch(); st.Start(); st.Stop(); long timeCount = st.ElapsedMilliseconds; st.Reset();