If i have 3 classes, lets say: Mainclass, ChildClass, OtherChild.
MainClass()
{
ChildClass cc = new ChildClass();
OtherChild oc = new OtherChild();
If I correctly understand your question, this can work. Note, my syntax may be wrong as I'm not super fluent at c# but I hope you can get the basic idea
MainClass()
{
ChildClass _cc = new ChildClass();
OtherChild _oc = new OtherChild();
ChildClass cc = get {return _cc;} set{_cc = value;}
OtherChild oc = get {return _oc;} set{_oc = value;}
oc.Parent = this;
//Set the name property of childclass
string childName = "some name";
}
ChildClass()
{
public string name {get; set;}
}
OtherChild()
{
//Here i want to get the name property from ChildClass()
//Doing this will make a new instance of ChildClass, which will not have the name property set.
Public MainClass parent {get; set;}
ChildClass cc = parent.cc;
}