Check if object is empty or NULL
<p>I want to check is object is empty or is NULL.</p>

<p>First I have a web method that take has input parameter XML document</p>

<pre><code>[WebMethod(CacheDuration = 0, EnableSession=true, Description = "Učitaj dokument iz Aurore")]
public System.Xml.XmlDocument Load_DOK(System.Xml.XmlDocument XmlDoc)   //xml doc
{
}
</code></pre>

<p>In this method I have to check if XmlDoc is empty, if is throw error.</p>

<p>I wrote something like this:</p>

<pre><code>try
{
    if( XmlDoc == null)
        errorMessage = "Input parameter is NULL!";
}
catch (Exception ex)
{
    WriteErrors.WriteToLogFile("WS.LOAD_DOK", ex.ToString());

    errorMessage = ex.Message;

    //Error exception
    soapEnvelop.LoadXml(@"&lt;soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""&gt;&lt;soap:Body&gt;&lt;Response_status&gt;1&lt;/Response_status&gt;&lt;Description&gt;" + ex.Message + "&lt;/Description&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;");
    return soapEnvelop;
}
</code></pre>

<p>I want to know is this the right way or is there a simpler way to do it?</p>
