.NET Framework: "uint" Argument Type Does Not Match CLS in P / Invoke

Can this warning be ignored?

The argument type "uint" does not match the CLS

I am developing a Compact Framework application and I have a lot of P / Invoke and I have to use uint, ushort etc. as parameter types.

I used [CLSCompliantAttribute(false)]to avoid warnings, but I do not know that it is safe.

Some help would be appreciated.

Thanks.

+3
source share
2 answers

, , CLS-. , ( ).

, uint - CLS- . , CLS.

( )

+14

, CLS, , CLS.

( User32, pinvoke.net):

[DllImport("user32.dll")]
static extern int ActivateKeyboardLayout(IntPtr nkl, uint Flags);

[DllImport("user32.dll")]
static extern int ActivateKeyboardLayout(IntPtr nkl, int Flags);

. , , - , ( 2 ).

+3

Source: https://habr.com/ru/post/1723900/


All Articles