C# Null Propagation

It makes things so simple, I really wish other languages had it. Today in five or six places I wrote something like


instead of

if (_innerObject != null) _innerObject.Dispose();

Long live DRY principle! Of course, our friend Juan Gandhi will probably say it is a Maybe monad (hey, how come in this day and age Chrome spell checker does not know the word “monad”?!). Anyhow, I wish this kind of shortcut were present in JavaScript. I really miss it. The proposal┬áis already there, but I am not sure how long it will take it to get to the standard, if at all.


    1. This is entirely possible. I wish more languages adopted this idea.


Leave a Reply

Your email address will not be published. Required fields are marked *