P/Invoke from C to C# without knowing size of array
问题 Right know in my code I have structure declared as like this, with fixed this 16, know at compile time. struct CONSOLE_SCREEN_BUFFER_INFOEX { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public int ColorTable[]; } but what I need is to be able to have this structure: struct CONSOLE_SCREEN_BUFFER_INFOEX { int arraySize; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0)] public int ColorTable[]; } get the arraySize from C function response, initialize ColorTable array with proper