I want to create common function to xml serialization but there is a problem need to typeof object that to be serialise but I don't know the type of object it can be (persondetails or logindetails) anything i reffered this example and trying to modify but typeof is underlineing with red please help me
original
static public void SerializeToXML(Movie movie)
{
XmlSerializer serializer = new XmlSerializer(typeof(Movie));
TextWriter textWriter = new StreamWriter(@"C:\movie.xml");
serializer.Serialize(textWriter, movie);
textWriter.Close();
}
My code
public class XmlSerialization
{
static public string SerializeToXML("What type have to put here")
{
string xmlReturn="";
XmlSerializer serializer = new XmlSerializer(typeof("What type have to put here"));
TextWriter textWriter = new StreamWriter(xmlReturn);
serializer.Serialize(textWriter, xml);
textWriter.Close();
return xmlReturn;
}
}