XML:
Code:
[serializable]
public class ActionClass
{
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public string ActionType { get; set; }
[XmlElement(Form = XmlSchemaForm.Unqualified)]
public DateTime ActionDate { get; set; }
}
public class ActionModel : List<ActionClass>
{
public ActionModel()
{
XmlSerializer xs = new XmlSerializer(typeof(ActionModel), "");
using (Stream ms = new FileStream("Demo.xml", FileMode.Open, FileAccess.Read))
{
object inp = xs.Deserialize(ms);
this.AddRange((ActionModel)inp);
}
}
}
Why I get exception on object inp = xs.Deserialize(ms)?