Thanks Tomas,
Iam getting error C2682: cannot use __try_cast to convert from
'Test:

erson' to 'Test::IPerson __gc *'
IPerson* iPerson = __try_cast<IPerson*>(__box(oPerson));
if I use the code above it does work, but I dont get a reference to the
original struct, it creates a new one (a copy). I am trying to get a
reference.
Here is the code for the interface & struct :
#pragma once
using namespace System;
namespace Test{
public __gc __interface IPerson{
__property String* get_Name();
__property void set_Name(String* _sValue);
__property int get_Age();
__property void set_Age(int _iValue);
};
public __value struct Person : IPerson
{
public:
__property String* get_Name(){
return m_sName;
}
__property void set_Name(String* _sValue){
m_sName = _sValue;
}
__property int get_Age(){
return m_iAge;
}
__property void set_Age(int _iValue){
m_iAge = _iValue;
}
String* ToString(){
return Name;
}
private:
int m_iAge;
String* m_sName;
};
}