Is the class NativeMethods handled specially in .NET?

前端 未结 4 1666
广开言路
广开言路 2021-01-11 20:33

https://msdn.microsoft.com/en-us/library/ms182161.aspx

Are the three classes described on this paged handled specially in the .NET Framework? (NativeMethods, SafeNa

4条回答
  •  情书的邮戳
    2021-01-11 21:13

    You can name your classes that way, but you will continue to get the code analysis warning CA1060. This warning indicates you are not following the convention. So to prevent this warning, you need to follow the convention when naming classes that have P/Invoke methods. If you want to categorize your P/Invoke methods, you can use namespaces. For example:

    • MyProject.Com.NativeMethods
    • MyProject.User32.NativeMethods
    • MyProject.OleStorage.NativeMethods

提交回复
热议问题