All pastes #28060 Raw Edit

Untitled

public text v1 · immutable
#28060 ·published 2005-11-09 00:40 UTC
rendered paste body
using System;
using System.IO;
using System.Collections;
using System.Xml.Serialization;

namespace ConsoleApplication4
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			UserSession u = new UserSession ();
			u.m_arrayList.Add ("foo");
			u.m_arrayList.Add ("bar");
			XmlSerializer s = new XmlSerializer (typeof (UserSession));
			Stream st = File.Create ("foobar.txt");
			s.Serialize (st, u);
			st.Close ();
			StreamReader r = new StreamReader (File.OpenRead ("foobar.txt"));
			Console.WriteLine (r.ReadToEnd ());
			r.Close ();
		}
	}

	public class UserSession
	{ 
		public ArrayList m_arrayList = new ArrayList();    
		public ArrayList MyArray 
		{
			get 
			{
				return m_arrayList; 
			}
		}
	}
}