throw new Exception vs Catch block
<p>Is there any behavioural difference between:</p>

<pre><code>if (s == null) // s is a string
{
 throw new NullReferenceException();
}
</code></pre>

<p>And:</p>

<pre><code>try
{
  Console.Writeline(s);
}


catch (NullReferenceException Ex)
{ // logic in here 
}
</code></pre>

<p>Both throw exceptions of null object, if s is null. The first example is more readable as it shows exactly where the error occurs (the exception bit is right next to the line which will cause the exception).</p>

<p>I have seen this coding style a lot on various blogs by various coders of all sorts of skill levels, but why not just perform the main logic by checking if s is not null and thus save the exception from ever being raised? Is there a downside to this approach?</p>

<p>Thanks</p>
