When translating the Windows API (including data types) into P/Invoke, should I replace DWORD with int
or uint
?
It\'s normally unsigned, but I
Well according to the MSDN DWORD
is an unsigned integer with a range of 0 to 4294967295.
So ideally you should replace it with uint
rather than int
.
However, as you have spotted uint
is non-CLS compliant so if your method is publicly visible you should use int
and do the conversion. The corollary to that is that if your method isn't used outside your assembly you should mark it as internal
rather than public
. Then you'll be able use a uint
.