How to add namespace at the time of xml serialization
<pre><code>            StringBuilder sb = new StringBuilder();
            XmlWriter writer = XmlWriter.Create(sb);
            XmlSerializer serializer = new XmlSerializer(typeof(OpenShipments));
            var ns = new XmlSerializerNamespaces();
            ns.Add("x-schema:", @"x-schema:C:\UPSLabel\OpenShipments.xdr");
            serializer.Serialize(writer, OS, ns);
            xmlString = sb.ToString();
</code></pre>

<p>getting error object reference not found because i add namespace programatically.
basically in my xml namespace will look like below one </p>

<pre><code>&lt;OpenShipments xmlns="x-schema:C:\UPSLabel\OpenShipments.xdr"&gt;
</code></pre>

<p>here i add the line <code>ns.Add("x-schema:", @"x-schema:C:\UPSLabel\OpenShipments.xdr");</code></p>

<p>and for the above line i am getting error....what is my mistake. just can not figure out. please help me to construct the namespace.</p>
