hrabia
Centurion
I have one base class. This class is used as parameter for method that serializes an object of that class to xml (using XmlSerializer).
class Base {.......}
class X
{
public void Serialize(Base obj)
{
XmlSerializer _o = new XmlSerializer(typeof(Base));
...................
}
}
I have second class that derives from base class.
class Second : Base {.......}
When I use object of second class as parameter for my method I need a type of my object for constructor of XmlSerializer(typeof(Second)).
Serialize(new Second());
But my method know only type of base class, and only XmlElemnts of base class are serialized. How can get this type dynamicaly?
class Base {.......}
class X
{
public void Serialize(Base obj)
{
XmlSerializer _o = new XmlSerializer(typeof(Base));
...................
}
}
I have second class that derives from base class.
class Second : Base {.......}
When I use object of second class as parameter for my method I need a type of my object for constructor of XmlSerializer(typeof(Second)).
Serialize(new Second());
But my method know only type of base class, and only XmlElemnts of base class are serialized. How can get this type dynamicaly?