re: Dealing with Nothing in C# - The Null Object Pattern VIEW POST

FULL DISCUSSION
 

Very well written and straightforward - thanks!

Using the same pattern but in the context of collections, C# has ways to define "empty" collections. For example, a collection of IEnumerable can use the Null Object pattern this way:

IEnumerable<SomeModel> collection = Enumerable.Empty<SomeModel>();

Looking forward to the next article!

code of conduct - report abuse