What is the proper way to check for and handle null return values?
<p>I have some methods that return a value (or object) if all went as planned, otherwise return null (something went wrong).</p>

<p>For example, <code>DataTable dt = DoSomething();</code>  If something blew up in <code>DoSomething()</code> the return value would be <code>null</code> and <code>dt</code> would be set to <code>null</code>.</p>

<p>There are other cases where I'm testing for a value and then setting a variable to the value if the test value is not null. This doesn't feel right. I'm calling the same method twice.</p>

<p>For example, if (String.IsNullOrEmpty(getAddresss())) {Do Stuff;} If I declare a variable before the test, the code could blow up when it gets set. If I test, then set it seems like I'm duplicating work.</p>

<p>What is the preferred way to test for and handle null values? </p>
