如何知道本机方法安全

如何知道本机方法安全

本文介绍了如何知道本机方法安全/不安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现这个功能:&安培;



根据这篇文章在,我要建立一个根据我将使用功能命名的类,但我的问题是:我怎么能知道在哪个班,我应该把GetSystemPowerStatusEx&安培; GetSystemPowerStatusEx2?



我迷路了......



感谢您的帮助。



我的问题是:这三个类名是好的,我(NativeMethods / SafeNativeMethods / UnsafeNativeMethods)



解决方案

It's a pretty silly warning and ultimately unproductive. But keeping it happy is simple, just add a static class to your project named NativeMethods and put the [DllImport] declarations inside it. No need for separate classes. Declare them internal.

Beware that you cannot call these functions on an emulator, testing them is going to require running it on the device itself. To keep your program debuggable in the emulator be sure to wrap the code that calls them with #ifdef DEBUG.

这篇关于如何知道本机方法安全/不安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 08:07