If you think that you need to have a circular dependency like that, there’s almost certainly a design flaw. Please see: What is the XY problem?
If you insist, though, something like this will actually work:
public class A
{
public B SomeB { get; set; }
public int SomeInt { get; set; }
}
public class B
{
public int SomeVar { get; set; }
public A SomeA { get; set; }
}
static void Main(string[] args)
{
A a = new A();
a.SomeB = new B();
a.SomeB.SomeA = a;
}
1
solved How do I get values from a class that depend on the one I need the value in? [closed]