Hi Steve!

Thanks for taking the time to read my article. It’s much appreciated!

The collection initialization syntax uses the Add() method behind the scenes. So, if you pass in null, it’ll just return and exit the method.

I did do unit tests before putting this up :)

Sure, extension methods are definitely a way to go. They do however serve a different purpose than the one I’m describing here.

Written by

Tech writer with 621K+ views. Sharing my opinion and what I learn. Danish C# backend engineer in FinTech. Ex Big4 senior tech consultant.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store