Try these definitions:
[StructLayout( LayoutKind.Sequential, CharSet = CharSet.Unicode )]
struct Name
{
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 16 )]
public string Value;
}
[StructLayout( LayoutKind.Sequential, CharSet = CharSet.Unicode )]
class A
{
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 24 )]
public Name[] Name = new Name[24];
}
[DllImport( @"MyDll.dll", CallingConvention = CallingConvention.StdCall )]
extern static void Test1( [In, Out] A a );
. . .
A a = new A( );
a.Name[1].Value = "str1";
Test1( a );
ā
// In C++:
struct A
{
wchar_t Name[24][16];
};
extern "C" __declspec( dllexport ) void __stdcall Test1( A * a )
{
wcscpy_s( a->Name[2], L"str2" );
}