C# object to delphi

Hi,

I’ve managed to create a .Net Plugin and then consume this plugin in Delphi 2007.
I want to take this a step further but don’t find the proper documentation to help me.

See c# code below. Basicly i want to be able to pass complex types from .net to delphi.
What approach should i take? I want to avoid flattening these objects to structs.

[Plugin(Name =“FirstPlugin”), NonVisualPlugin]
public partial class TestClass : NonVisualPlugin, ITestClass
{
public TestClass()
{
InitializeComponent();
}

public TestClass(IContainer container)
{
    container.Add(this);

    InitializeComponent();
}


public SomeObject GetComplexObject()
{
    return new SomeObject()
    {
        Description = "testdata",
            Objs = new List<SomeOtherObject>()
            {
                new SomeOtherObject(){ Data = "Other data" }
            }
        };

}   

}

public class SomeObject
{
public string Description { get; set; }
public List Objs { get; set; }
}

public class SomeOtherObject
{
public string Data { get; set; }
}

First you need to to define interfaces of your complex objects. These interfaces have to be inherited from the IHYCrossPlatformInterface interface. Interfaces can contain properties and methods. All types used in these interfaces have to be either primitive types OR descendants of IHYCrossPlatformInterface interface OR arrays of types mentioned above (so you won’t be able to use List type in the interface).
Defined interfaces have to be marked with Guid attribute.

After that you need to define classes implementing these interfaces and then to use them.

So in your case it would look like

	[Guid("093197A9-B9C4-477B-8150-4484278CF48F")]
	public interface ITestClass
	{
		ISomeObject GetComplexObject();
	}

	[Guid("E10BF2A0-D646-46A5-A620-F965A327E525")]
	public interface ISomeObject
	{
		string Description { get; set; }
		ISomeOtherObject[] Objs { get; set; }
	}

	[Guid("8BA34B21-DE0C-4ED5-97F0-F349DB10FF50")]
	public class ISomeOtherObject
	{
		public string Data { get; set; }
	}
	
	public class SomeObject : ISomeObject
	{
		public string Description { get; set; }
		public ISomeOtherObject[] Objs { get; set; }
	}

	public class SomeOtherObject : ISomeOtherObject
	{
		public string Data { get; set; }
	}

Regards