你好,我的问题是是否可以在 C# 中使用 TimesSpan 打印微编码。
我有下一个例子:
DateTime startTime = DateTime.Now;
..../some code
DateTime endTime = DateTime.Now;
TimeSpan totalTimeTaken = endTime.Subtract(startTime);
Label3.Text=(totalTimeTaken.Milliseconds).ToString();
此代码允许我以毫秒为单位显示,但我需要显示微秒有没有办法将其更改为微秒或者我必须使用其他东西?
必须编辑我的问题:我的目标是测量在 2 个 DateTime 之间花费的时间,因为它是几行代码,毫秒不会削减它,这就是我需要微秒的原因。