How to retrieve data elements of an object when it refrences another object?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sri13
    New Member
    • Sep 2010
    • 11

    How to retrieve data elements of an object when it refrences another object?

    How can I access the elements from the object obj in this example?

    Code:
    class Shapes
    {
      int shapeid;
      string name;
    }
    
    Shapes shape = new Shape();
    shape.shapeid = 10;
    shape.name = "roger";
    
    object obj = shape;
    How can I access obj.shapeid and obj.name??? This is just a hypothetical example. In real scenario I call a webservice method with a proxy, which return a object. I want to browse through the object to see the data with in. When I debug in VS, I see the data and child objects within but not sure how to get them programatically ?
  • NitinSawant
    Contributor
    • Oct 2007
    • 271

    #2
    use reflection to get properties and values of the object

    Comment

    Working...