Today I decided to check how Enumerable.EmptyT() works and wasn’t satisfied with the knowledge I got. I started digging a little bit deeper and wasted some of the precious beauty-sleep time so if you want to know what’s happening when you add an element to an empty collection, let me tell you a story of today’s night.
Architektura 2252 dni, 3 godziny, 24 minuty temu 372 źrodło rozwiń
Enumerable.Empty Jeśli funkcja zwraca IEnumerable, nie zwracaj pustej dopiero co stworzonej listy. Enumerable.Empty() jest właśnie tym czego oczekuje wywołujący kod. return new MyClass[0]; // Better return Enumerable.Empty
Sztuka programowania 4226 dni, 23 godziny, 10 minut temu 423 źrodło rozwiń