BP13: Defensive copies of objects
Always return defensive copies of objects that aren't immutable if you don't intend for the user of your API to make changes to them.
In C#, structs are a value type so you don't need to make a defensive copy of them. You need to make clones and/or copy constructors of classes to make defensive copies.
However, collections in particular have a bunch of special methods to handle it: In C#
- Array.AsReadOnly(T[]) is a static method that will return a ReadOnlyCollection
that is a wrapper around the array List has .AsReadOnly() to wrap it in a ReadOnlyCollection For Dictionaries, you can instantiate ReadOnlyDictionary directly; its constructor takes an IDictionary
Chat
Oh, the operator is not available. Leave us your comments. We will answer all your questions as soon as possible.
Anonymous
Καλησπέρα.
Καλησπέρα.
Anonymous
the infinteis -3/15 so 1triition / infinet
the infinteis -3/15 so 1triition / infinet
Anonymous
e
e
Anonymous
<a href="https://inspirum.pl "
<a href="https://inspirum.pl "
Anonymous
[url]https://inspirum.pl[/url]
[url]https://inspirum.pl[/url]
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e