What is the equivalent to System.nanoTime() in .NET?

前端 未结 7 1474
暖寄归人
暖寄归人 2021-01-07 20:22

The title is pretty much self-explanatory, I\'m killing myself over this simplicity.

Looked here, but it isn\'t much helpful.

7条回答
  •  温柔的废话
    2021-01-07 20:35

    DateTime.Now.Ticks

    I was trying to find the answer to this to run some performance testing.

    DateTime startTime = DateTime.Now;
    generatorEntity.PopulateValueList();
    TimeSpan elapsedTime = DateTime.Now - startTime;
    Console.WriteLine("Completed! time(ticks) - " + elapsedTime.Ticks);
    

提交回复
热议问题