System.Environment.TickCount的WinRT的更换 [英] WinRT Replacement of System.Environment.TickCount

查看:223
本文介绍了System.Environment.TickCount的WinRT的更换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是WinRT的替代System.Environment.TickCount?

What is the WinRT replacement for System.Environment.TickCount?

推荐答案

应该是可用的,因为它的不是问题。但它不是一个[TypeForwardedTo]挂断我猜是因为的GetTickCount()不是白名单和.NET没有采取GetTickCount64上。标准的后备工作正常,你可以使用的PInvoke调用本地Windows功能。我验证了使用它的程序通过在Windows应用程序认证工具包测试。

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();

请注意,它返回一个长期的,不是一个int。你可以简单地强制转换为int截断,如果在C#中是很重要的(但不是vb.net,只是说谎的返回类型)

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)

这篇关于System.Environment.TickCount的WinRT的更换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆