Should I Prefer a Closed or Open List<> System?
Posted
by Tyler Murry
on Stack Overflow
See other posts from Stack Overflow
or by Tyler Murry
Published on 2010-05-22T16:03:09Z
Indexed on
2010/05/22
16:10 UTC
Read the original article
Hit count: 422
Hey guys,
I've got a class in my project that stores a List<> of elements. I'm trying to figure out whether I should allow the user to add to that List directly (e.g. Calling the native add/remove methods) or lock it down by declaring the List private and only allowing a handful of methods I choose to actually alter the List.
It's a framework, so I'm trying to design it as robustly as possible, but I also want to keep it as simple and error-free as possible.
What's the best practice in this situation?
Thanks, Tyler
© Stack Overflow or respective owner