mejobloggs
❔ Is it a problem to be creating lots of empty lists etc just to avoid null checks?
It sounds like Enumerable.Empty<T>() or Array.Empty<T>() might be a better way, reading through here it sounds a more efficient equivilent https://stackoverflow.com/questions/8555865/is-there-an-empty-list-singleton-in-c
11 replies
❔ Is it a problem to be creating lots of empty lists etc just to avoid null checks?
performance isnt particularly critical i just felt like i was doing something wrong generating thousands of empty lists just to save me from null checking and wondered if there was a better way
11 replies