问题描述
可以忽略此警告吗?
参数类型'uint'不符合CLS
Argument type 'uint' is not CLS-compliant
我正在开发Compact Framework应用程序,并且有很多P/Invoke,必须使用uint,ushort等作为参数类型.
I'm developing a Compact Framework applicatin and I have a lot of P/Invoke and I have to use uint, ushort, etc. as parameter's types.
我已经使用 [CLSCompliantAttribute(false)]
来避免出现警告消息,但我不知道它是安全的.
I've used [CLSCompliantAttribute(false)]
to avoid the warning messages but I don't know it is safe.
一些帮助将不胜枚举.
谢谢.
推荐答案
如果您不打算使用其他语言编写供其他人使用的组件,则无需符合CLS.只需声明您尚未(如已完成)即可.
If you are not writing a component intended to be used by others in a different language, then you do not need to be CLS-compliant. Just declare that you are not (as you've already done).
但是,可以在内部使用uint并仍然提供符合CLS的接口.编写符合CLS的代码.
However, it is possible to use uint internally and still provide a CLS compliant interface. Writing CLS-Compliant Code.
(链接已更新)
这篇关于.NET Framework:参数类型'uint'在P/Invoke上不符合CLS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!