Menu

parent.Childs.Count as a property column

2005-11-20
2013-03-07
  • gennadii_donchyts

    Hi,
    Is it possible to add properties of the child object collections to the parent object view?
    something like this:

    class Parent { private IList childs; }

    view = new ObjectView(typeof(Parent));
    view.AddColumn("Childs.Count", "Number of Childs");

    --Gena

     
    • Martijn Boland

      Martijn Boland - 2005-11-24

      I just tried it, and it doesn't seem to work because the type of the collection is IList and that interface itself doesn't have a Count property (it is inherited via ICollection). Maybe with some extra binding flags it's possible to reach the Count property.

      Also changing the IList to an ArrayList might do the trick.

       
    • Donald L Mull Jr.

      Hmm, that should work. I've used inherited properties before. I'll make an issue in jira for it.

       

Log in to post a comment.

MongoDB Logo MongoDB