I have a relatively simple C#class that I would like to marshal into a VB project. It looks like this (I simplified a bit for this post):
[Guid("AAAAAAAA-AAAA-AAAA-AAAA-123456789ABC", ClassInterface(ClassInterfaceType.AutoDual), ComVisible(true)]
[ProgId("MyBiz.MyResponse")
[Serializable]
public class MyResponse
{
public bool Success { get; set; }
public int ID{ get; set; }
public string Location{ get; set; }
public ArrayList Messages { get; set; }
}
Messages contains 0 or more strings. I compile this and create a type library to be used by VB6. Everything work well in terms of data getting passed from the simple types, but the Messages variable, while the VB runtime recognizes it as an ArrayList, does not contain any data in it even when it should. What am I missing, in terms of marshaling the data? I know that generics do not marshal, but I believe an ArrayList does. Am I missing an attribute, or something else?
No need to offer alternative solutions, as I am asking this because I want to know how to do it, not because I don't have alternatives if I can get this to work. Thanks!
List<string>
in your code. – Hans Passant