C# Protecting private collections from modification – Part 2

The common object issue In the last part I wrote about how you can protect a class’s private collections from modification by wrapping them in a ReadOnlyCollection before exposing them. But how about collections that are handed to your class? Consider the following code: What happens here is that MyClass takes a variable of reference …

C# Protecting private collections from modification – Part 2 Läs mer »

Rulla till toppen