title: Get namespace from xml file C#
body: <p>I've browsed the questions with similar titles but cannot seem to find exactly what I'm looking for,if anyone spotted a similar question kindly point me to the thread.Here is my question:</p>
  
  <p>I have an xsd file which starts of like this:</p>
  
  <p><img src="https://i.stack.imgur.com/eR3gW.jpg" alt="Beginning of my xsd file">
  I need to know how to programatically access the namespace value of the above file.</p>
  
  <p>Additionally my solution needs to be generic so I cannot simply search for <code>xmlns:xs</code> because the exact name of the namespace may have a different name</p>
  
  <p>I've tried the following, but when debugging the value of the <code>elementNamespace</code> variable is blank <code>""</code>:</p>
  
  <pre><code>XElement elemet = XElement.Load(@"D:\xsd\Response.xsd");
  string elementNamespace = elemet.GetDefaultNamespace().NamespaceName;
  System.Diagnostics.Debug.WriteLine("Namespace " + elementNamespace);
  </code></pre>