none
Hazards of exposing Controls collection as protected? RRS feed

  • Question

  • For unit testing, I'm developing mock form classes that inherit from my forms. This requires a lot of extra properties on the forms to expose the private members as protected. Is there a problem with simply exposing the Controls collection through a protected property?

    Thanks in advance.

    Tuesday, July 10, 2007 2:48 PM

Answers

All replies

  • I don't see any particular problem with it. If you want to be cautious and ensure nothing external can modify the collection, you can make the property readonly.
    Tuesday, July 10, 2007 5:51 PM
  • It is already public, no need to expose it again.
    Tuesday, July 10, 2007 6:32 PM
    Moderator