26. August 2012 10:24
In .NET normally arrays are reference types and any array declared as part of a structure doesn't physically exist inside the struct.Only a reference to the array is placed inside the structure, which points to the original location of the array on the heap.Hence declaring a C++ style fixed-size structure was difficult in earlier versions of C#.
In C# 2.0, it's now possible declare arrays in structure as fixed-sized inside unsafe code blocks. Fixed arrays will typically be part of a structure that's passed to a native API.
public unsafe struct CharArray
public fixed char fixSizeBuffer;