When I pass in a struct to some PInvoke method, I will receive the error
Unhandled Exception: System.AccessViolationException: Attempted to read or write
protected memory. This is often an indication that other memory is corrupt.
When I use class, then it is OK.
I want to know any reason behind that?
MSDN states in this article:
You will also find additional information that will come in handy when using PInvoke there.