Hey Abhshake,
Basically we create struct /class to create objects.
Class / struct holds the definition of an object so that when an object is created it will hold reference of each of its members.
Now Nesting a class or struct does not mean that the properties from outside will be accessible. One thing which you might do is
public class MyShape
{
public struct MyNestedStruct
{
public MyShape ParentObject {get;set;}
public MyNestedStruct(MyShape sobj)
{
this.MyShape = sobj;
}
}
public MyNestedStruct MyStruct = new MyNestedStruct(this);
}
Now from the nested struct you can access the object of MyShape.
Actually you can only access the properties from within a class by its object. You cannot access a property without an object.
So in your case, rather than creating a Struct it is better to expose properties as Member of the class, or if you wish you can send the object this to the struct to get reference to the parentobject.
:rose: