Way to check for null value in if condition
<p>I have the following line of code, which is giving me trouble of NPE</p>

<pre><code>   ServeUrl = ((NameValueCollection)ConfigurationManager.GetSection("Servers")).Get(ment);
</code></pre>

<p>When I write this in the following way, I no longer get the NPE</p>

<pre><code>  if (ConfigurationManager.GetSection("Servers") != null &amp;&amp; ((NameValueCollection)ConfigurationManager.GetSection("Servers")).Get(ment) != null)
                            {
                                ServeUrl = ((NameValueCollection)ConfigurationManager.GetSection("Servers")).Get(ment);
                            }
</code></pre>

<p>Somwhow, the above thing does not look good to my eyes. How can I write this in a better way?</p>
