Timespan in C# converting to int? Somehow?
I'm trying to use the开发者_开发问答 Timespan class to create a start time and a stop time, get the difference and ultimately dividing and multiplying the result against another number.
The problem is getting into something I can work with.
Any suggestions?
The TimeSpan class has a number of members which might be able to assist, for instance TotalSeconds, TotalMinutes, TotalHours etc.
If you want to know the number of operations per second, divide the number of operations by the TotalSeconds member of the TimeSpan object.
If you're trying to measure code running time, the stopwatch class might be more appropriate.
精彩评论