Difference between ElapsedTicks, ElapsedMilliseconds, Elapsed.Milliseconds and Elapsed.TotalMilliseconds? (C#)

前端 未结 4 2065
天涯浪人
天涯浪人 2020-12-02 20:19

I\'m totally confused between these 4. What is the difference between ElapsedMilliseconds (long), ElapsedTicks (long), Elapsed.TotalMilliseconds (double) and Elapsed.Millise

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 20:58

    Reflecting the Stopwatch class reveals that ElapsedMilliseconds is Elapsed ticks converted (and rounded) to milliseconds:

    public TimeSpan Elapsed
    {
      get
      {
        return new TimeSpan(this.GetElapsedDateTimeTicks());
      }
    }
    
    public long ElapsedMilliseconds
    {
      get
      {
        return this.GetElapsedDateTimeTicks() / 10000L;
      }
    }
    

提交回复
热议问题