Should I use a closed or open <> System list?

I have a class in my project that stores List <> elements. I am trying to find out if I should allow the user to add to this list directly (for example, calling my own add / remove methods) or block it by declaring a personal list and allowing only a few methods that I actually find the List.

This is a framework, so I'm trying to create it as reliably as possible, but I also want it to be as simple and error-free as possible.

What is the best practice in this situation?

Thanks Tyler

+5
source share
6 answers

.

, , .

-, .

. , , - . , , .

+2

( , )

- .

+1

, .

, , , - , , , , .

, - , .., .

, ,

+1

. . Jon Skeets . , , . , - .

.NET 3.5 , List < > ReadonlyCollection. -, .

FxCop. , ..

+1

, . , , , . NotSupportedException, .

0

@Dylan Vester: , . , / .

0

All Articles