1

I am coding a C# forms application where I am using a class with a PropertyGrid. I am needing to have Lists that have nested Lists, and some Lists have other objects that need to be selected.

My question is this: Do I have to use a CollectionBase for collections? All of the tutorials I have seen online use a CollectionBase, however I have tried a simple test application with a List, and the List works correctly so far.

I am asking this so that I do not get in depth into my code, and realize that a CollectionBase is needed for certain PropertyGrid actions.

Thanks.

Simon
  • 7,991
  • 21
  • 83
  • 163
  • 1
    possible duplicate of [Displaying a Collection in a PropertyGrid Control](http://stackoverflow.com/questions/638184/displaying-a-collection-in-a-propertygrid-control) – sara Aug 13 '15 at 09:56
  • 1
    I am asking whether I NEED to use a CollectionBase, not how to use a CollectionBase. The above duplicate links to an old resource, and is one of the many resources I have had a look at. – Simon Aug 13 '15 at 10:20
  • The linked resources makes it pretty clear that the `ICustomTypeDescriptor` interface doesn't care about what the underlying type is, as long as it fulfills it's contract to the interface. There is no way for the interface to know anything at all about the runtime type of the implementing class. – sara Aug 13 '15 at 10:30
  • 1
    I can decorate the class with the required attributes for the properties, without using a ICustomTypeDescriptor and the list works correctly. Hence, I am asking about whether the CollectionBase is needed. – Simon Aug 13 '15 at 11:07

0 Answers0