I'm trying to so some serialization using C#, but it throws an exception saying that there was an error generating the xml document. This is where I do the serialization:
public void serialize()
{
try
{
XmlSerializer ser = new XmlSerializer(typeof(Repository<Student>));
StreamWriter myWriter = new StreamWriter("stud.xml");
ser.Serialize(myWriter, rep);
myWriter.Close();
}
catch (Exception e)
{
Console.WriteLine("Error " + e.Message);
}
}
And this is the class I want to serialize:
public class Repository<T> : MyStack<T>
{
public int size;
public int capacity;
public SLL<T> stud;
public Repository()
{
/*
* Creator for class Repository.
*/
this.stud = new SLL<T>();
this.capacity = 20;
this.size = 0;
}
where MyStack is an interface, and SSL<T> is singly-linked list I have implemented.