I have a new project that I'm working on that uses a TextWriter object to serialize a class. Something like this:
TextWriter txtStream = new StreamWriter("xmlStreamFile.xml");
xmlSel.Serialize(txtStream, gp); // gp is the class I want to serialize
txtStream.Flush();
txtStream.Close();
This code works the first time I use it - the file is created and the data is written ok - but the second time I try to use it I get a excception: "Cannot write to ca closed TextWriter". I just wanted to ask how can I reopen the TextWriter - or what should I do not to get this type of exception and be able to rewrite the txtStream Object. Thanks!