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 1863 dni, 4 godziny, 22 minuty temu 370 ź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 3838 dni, 9 minut temu 422 źrodło rozwiń