In C#, I defined a struct:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MyObject
{
[MarshalAs(UnmanagedType.LPWStr)]
publ
You probably mean:
struct MyUnmanagedStruct {
LPWSTR var1, var2;
};
Then you can use Marshal.StructureToPtr
as suggested by Botz3000. Otherwise C#'s
public struct MyObject {
public String var1;
public String var2;
}
and C++/CLI's
public struct value MyObject {
public String^ var1;
public String^ var2;
}
are completely equivalent, assuming your're you're using the same System.String
on both sides.