I have serialized a following log class:
[Serializable]
[XmlRoot("Log")]
public class Log
{
[XmlElement("ErrorLog")]
public ErrorLog Error { get; set; }
[XmlElement("MessageLog")]
public MessageLog Message { get; set; }
}
public class ErrorLog
{
[XmlElement("ErrorMessage")]
public string ErrorMessage { get; set; }
[XmlElement("Module")]
public string Module { get; set; }
[XmlElement("Component")]
public string Component { get; set; }
}
public class MessageLog
{
[XmlElement("Message")]
public string Message { get; set; }
[XmlElement("Module")]
public string Module { get; set; }
}
I am serializing the above Log class in an XML File as:
abc TestClient
abc TestClient DataAccessLayer
Is it possible that I add all elements whether they are ErrorLogs or MessageLogs inside a single root like: abc TestClient DataAccessLayer abc TestClient