When should I explicitly specify a StructLayout?

Posted by biozinc on Stack Overflow See other posts from Stack Overflow or by biozinc
Published on 2008-12-26T16:25:01Z Indexed on 2010/03/17 4:51 UTC
Read the original article Hit count: 179

Filed under:
|
|
|

I'm fiddling with calling DLLs from C#, and came across the need to define my own structs. Lots of articles force a sequential layout for the struct with

[StructLayout(LayoutKind.Sequential)]
struct Foo ...

So, I followed suite, and my programme worked. Now, when I took the line out, it still works. Why do I need it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about interop