.NET Framework Marshalling arrays


Example

Arrays of simple type

[DllImport("Example.dll")]
static extern void SetArray(
    [MarshalAs(UnmanagedType.LPArray, SizeConst = 128)]
    byte[] data);

Arrays of string

[DllImport("Example.dll")]
static extern void SetStrArray(string[] textLines);