title: Method call if not null in C#
body: <p>Is it possible to somehow shorten this statement?</p>
  
  <pre><code>if (obj != null)
      obj.SomeMethod();
  </code></pre>
  
  <p>because I happen to write this a lot and it gets pretty annoying. The only thing I can think of is to implement <strong>Null Object</strong> pattern, but that's not what I can do every time and it's certainly not a solution to shorten syntax.</p>
  
  <p>And similar problem with events, where </p>
  
  <pre><code>public event Func&lt;string&gt; MyEvent;
  </code></pre>
  
  <p>and then invoke</p>
  
  <pre><code>if (MyEvent != null)
      MyEvent.Invoke();
  </code></pre>