Better yet, skip the assign when it isn't needed:
(list ?? (list = new List())).Add ("test");
Now, if the language allowed 'ref this' on the extension argument it could be totally transparent to the caller. Or be able to declare a create-if-null semantic on the variable if a default ctor is available (pretty sure VB4 did this 20+ years ago).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Better yet, skip the assign when it isn't needed:
(list ?? (list = new List())).Add ("test");
Now, if the language allowed 'ref this' on the extension argument it could be totally transparent to the caller. Or be able to declare a create-if-null semantic on the variable if a default ctor is available (pretty sure VB4 did this 20+ years ago).