Serializing a stack to XML in C#

Serializing a class to XML in C# is straightforward; most collections can be easily serialized also. Something like the following will work in most scenarios - 1 2 3 4 5 6 7 8 9 10 11 public string GetSerializedString<T>(T objectToSerialize) { var serializer = new XmlSerializer(typeof(T)); TextWriter textWriter = new StringWriter(); var xmlWriter = XmlWriter.

Deserializing to an enum

I have an application where I deserialize an xml stream from a third party. One of the fields is a task code which can be one of only three values, insert, update and delete.