I need to pass data from C# to C++ in my WP8 app.
I have learned that there's a mapping from .NET to Windows Runtime Component. For instance:
System.String
maps to Platform::String^
.
IReadOnlyList<String>
maps to Windows::Foundation::Collections::IVectorView<Platform::String ^>^
.
But what does custom (i.e. user-defined) class map to?
E.g. I have in C# side
public class MyDesc
{
public string m_bitmapName { get; set; }
public string m_link { get; set; }
}
public IReadOnlyList<MyDesc> getDescs()
{
return new List<MyDesc>();
}
What do I call it on C++ side? In other words, what do I substitute "???" to below:
virtual Windows::Foundation::Collections::IVectorView<??? ^>^ getDescs();
You need to declare the MyDesc class in the C++/CX component that your C# code is referencing.
So in your C++/CX you would have:
Then you'll be able to pass a vector/list of MyDesc objects between C++/CX and C#