Hi Friends,

I have a beautiful article about XML namespace collission here <http://msdn.microsoft.com/en-us/magazine/cc164122.aspx>.

The answer for the question 1 is suitable for me, except that I have a slightly different situation.

I have to get the properties of derived class instead of the base.

Case :
My B.clsPerson is inheritting A.clsPerson (A and B are namespaces) and I am not supposed to modify A.clsPerson.
What should be done during this case?
I still have the conflict as I am not authorized to alter anything inside the 'namespace A'.

Code:

namespace A //(NOT AUTHORIZED TO MODIFY)
{
public class clsPerson
{
public string szName
{
get;
set;
}

public string szAddress
{
get;
set;
}
}
}

namespace B
{
public void Serialize(string filename)
{
try
{
B.clsPerson clsperson = new B.clsPerson();
clsperson.szAddress = "Address";
clsperson.szName = "Name";

lstClsPerson.Add(clsperson);

clsperson = new B.clsPerson();
clsperson.szAddress = "Add";
clsperson.szName = "Eman";

lstClsPerson.Add(clsperson);

System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(lstClsPerson.GetType());
StreamWriter streamWriter;
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
}
streamWriter = System.IO.File.CreateText(filename);
x.Serialize(streamWriter, lstClsPerson);
streamWriter.Flush();
streamWriter.Dispose();
}
catch (Exception ex) { MessageBox.Show(ex.InnerException.Message); }
}

public class clsPerson : A.clsPerson
{
public string szCountry
{
get;
set;
}
}
}

ERROR

InnerException = {"Types 'A.clsPerson' and 'B.clsPerson' both use the XML type name, 'clsPerson', from namespace ''. Use XML attributes to specify a unique XML name and/or namespace for the type."}

What should be done to over come this?

Regards
Ansaf Mohammedali