I have something similar to the following in C#:
public class ClassA
{
int Id { get; set; }
ClassB[] ClassBItems { get; set; }
}
and
public class ClassB
{
int SomeOtherId {get;set;}
}
I want to pass this object model into unmanaged C++. I.e. Have a call from the unmanaged C++ code such as 'GetClassA() : ClassA'.
So far, I have managed to pass single objects or arrays of objects from managed C# to unmanaged C++ (using COM/CCW), but haven't been pass ClassA with ClassB inside it.
My questions are:
- How can I pass back ClassA which a ClassB array inside it?
- So far, I have only been able to pass back structs from C#. My examples above are classes which is what I'd actually like to pass back. I.e. a reference to the data.
To clarify, the unmanaged code will be calling the managed code.