Collection initializer: List<T>
We're all used to write new List<int> { 1, 2, 3, 4 } or new int[] { 1, 2, 3, 4} to initialize collections with
values. Syntactically, they look similar, but the behavior is different, and you should be careful if you are worried
about
performance.
Инициализатор коллекций: List<T>
Мы все привыкли писать new List<int> { 1, 2, 3, 4 } или new int[] { 1, 2, 3, 4}, чтобы инициализировать коллекции какими-то значениями. Синтаксически это выглядит похоже, но поведение отличается, и вам следует быть осторожными, если вы заботитесь о производительности.
List initializer
We all used to type new List<int> { 1, 2, 3, 4 } or new int[] { 1, 2, 3, 4} to initialize collections with some values. It looks similar in syntax but differs in behavior, and you should be careful if you are concerned about performance.
Harmful collection transformations. Part 3: collections
Starting with string in the first post we continue to study examples with collection transformations and how they affect our applications.