I have 2 interfaces IA and IB.
public interface IA
{
IB InterfaceB { get; set; }
}
public interface IB
{
IA InterfaceA { get; set; }
void Set
Interface properties are not serializable. However, fields that reference those properties (in the subclass) are.
You'll need to do something like this:
[Serializable]
public class ClassA : IA
{
private IB _interfaceB;
public IB InterfaceB { get { return _interfaceB; } set { _interfaceB = value; } }
public ClassA()
{
// Call outside function to get Interface B
IB interfaceB = Program.GetInsanceForIB();
// Set IB to have A
interfaceB.SetIA(this);
}
}
[Serializable]
public class ClassB : IB
{
private IA _interfaceA;
public IA InterfaceA { get { return _interfaceA; } set { _interfaceA = value; } }
public void SetIA(IA value)
{
this.InterfaceA = value as ClassA;
}
}