using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
namespace test
{
public class World
{
public int a;
static World world;
static void Main(string[] args)
{
//Create
World w = new World();
w.a = 5;
//Save
world = w;
Save();
//Load
//Load();
//Console.WriteLine("Loaded World a:{0}", world.a);
}
static void Load()
{
TextReader file = new StreamReader("World.xml");
XmlSerializer serializer = new XmlSerializer(typeof(World));
world = (World)serializer.Deserialize( file);
}
static void Save()
{
TextWriter file = new StreamWriter("World.xml");
XmlSerializer serializer = new XmlSerializer(typeof(World));
serializer.Serialize(file, world);
}
}
}