public PlayerData(MyCities city) { cityID = city.cityID; cityName = city.cityName; cityPop = city.cityPop; cityArea = city.cityArea; }
public static void SaveMyCities(MyCities city) { BinaryFormatter formatter = new BinaryFormatter(); string path = "D:/mycities.save"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(city); formatter.Serialize(stream, data); stream.Close(); }