我对移动技术的发展完全陌生。我需要一个秒表的例子。我的项目是基于跨平台的xamarin.forms,运行ios作为主要平台。请帮帮我!谢谢!
发布于 2018-04-21 17:18:17
.NET API浏览器是一个很好的资源,在这里您可以找到所需的一切,并且在大多数情况下可以使用示例。
在.NET API浏览器中:
using System;
using System.Diagnostics;
using System.Threading;
class Program
{
static void Main(string[] args)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
Thread.Sleep(10000);
stopWatch.Stop();
// Get the elapsed time as a TimeSpan value.
TimeSpan ts = stopWatch.Elapsed;
// Format and display the TimeSpan value.
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Milliseconds / 10);
Console.WriteLine("RunTime " + elapsedTime);
}
}完整的文档可以找到这里。
P.S.:我共享的针对.NET标准2.0的链接
https://stackoverflow.com/questions/49952115
复制相似问题