If Marshal.GetLastWin32Error exposes the Win32 GetLastError function from Kernel32.DLL then why is it retuning an int, where as GetLastError is returning a DWORD which is unsigned.
If Marshal.GetLastWin32Error exposes the Win32 GetLastError function from Kernel32.DLL then why is it retuning
Share
Because unsigned integers are not CLS compliant. In the early days, VB.NET and J# couldn’t handle them, two out of the four supported languages. That’s been fixed, but there are still many languages around that can run on the CLR but don’t supported unsigned integers, Java being the best known example.