What is the WinRT replacement for System.Environment.TickCount?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It should be available, because it isn't a problem. But it is not, a [TypeForwardedTo] hangup I guess because GetTickCount() isn't on the white list and .NET never adopted GetTickCount64. The standard fallback works fine, you can use pinvoke the call the native Windows function. I verified that a program that uses it passes the Windows App Certification Kit test.
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private static extern long GetTickCount64();
Note that it returns a long, not an int. You can simply cast to int to truncate if that's important in C# (but not vb.net, just lie about the return type)
回答2:
It appears System.Environment.TickCount is supported in Windows 8 Windows store apps now.