[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

How to get C# object in C++

sa.renjith

10/12/2007 10:58:00 AM

Hi,
I have a C# libarary in which I'm returning class object. C# code is
as follows:
namespace ClassLibrary1
{
public class clsCS
{
private string name;
private int age;
public string HBName
{
get
{
return this.name;
}
set
{
this.name = value;
}
}

public int HBAge
{
get
{
return this.age;
}
set
{
this.age = value;
}
}
}

public interface ICalculator
{
clsCS GetClassData();
}
public class ManagedClass:ICalculator
{
clsCS clsCSOb;
public ManagedClass()
{
}

public clsCS GetClassData()
{
clsCSOb = new clsCS();
clsCSOb.HBName ="XBU";
clsCSOb.HBAge = 67;
return clsCSOb;
}

}
}


I have a C++ client, in which compiler generated .TLI file "clsCS" has
mangled ad "_clsCS".

Now I called C# method from C++ as follows:
_clsCSPtr pCSObj = NULL;
pCSObj = pICalc->GetClassData();

here "pCSObj" has some value.

But HOW I RETRIEVE pCSObj->HBName? If I return a class array from C#,
how do I get those list in C++.

Hope I was clear with my explanation.
Thanks in advance