Similiar to a previous poster, but this is what I use to serial objects to
store in Intents...

public class SimpleSerializer
    {
        public static T DeserializeObject<T>(string source)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(T));

            StringReader sr = null;
            
            try
            {
                sr = new StringReader(source);

                T result = (T)serializer.Deserialize(sr);

                return result;
            }

            finally
            {
                Memory.DisposeGarbage(sr);
            }
        }

        public static string SerializeObject(object target)
        {
            XmlSerializer serialize = new XmlSerializer(target.GetType());

            StringWriter sw = null;
            
            try
            {
                sw = new StringWriter();

                serialize.Serialize(sw, target);

                string result = sw.ToString();

                return result;
            }

            finally
            {
                Memory.DisposeGarbage(sw);
            }
        }
    }

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Being-driven-insane-tp5016975p5017416.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to