System.Runtime.InteropServices.DllImportAttribute.SetLastError Field

Indicates whether the callee calls the SetLastError Win32 API function before returning from the attributed method.

Syntax

public bool SetLastError

Remarks

true to indicate that the callee will call SetLastError; otherwise, false. The default is false.

The runtime marshaler calls GetLastError and caches the value returned to prevent it from being overwritten by other API calls. You can retrieve the error code by calling Marshal.GetLastWin32Error.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0