convert struct handle from managed into unmanaged C++/CLI
In C#, I defined a struct: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct MyObject { [MarshalAs(UnmanagedType.LPWStr)] public string var1; [MarshalAs(UnmanagedType.LPWStr)] public string var2; }; I have this struct in C++: public value struct MyObject { LPWSTR var1; LPWSTR var2; }; And in the method of C++ which is a public class to be called from C#: TestingObject(MyObject^ configObject) { // convert configObject from managed to unmanaged. } The object is debugged correctly that I can see two strings var1 and var2. However, the problem now is that I need to