コード例 #1
0
        static void TESTClone(PlanetarySystem systemToClone)
        {
            var clone = systemToClone.Clone();

            clone.Name      += "CLONE";
            clone.Star.Name += "CLONE";
            clone.Planets.ToList().ForEach(p => p.Name   += "CLONE");
            clone.Moons.ToList().ForEach(m => m.Name     += "CLONE");
            clone.Asteroids.ToList().ForEach(a => a.Name += "CLONE");
            clone.Moons.ToList().ForEach(art => art.Name += "CLONE");

            Console.WriteLine(systemToClone.Name);
            Console.WriteLine(systemToClone.Star.Name);
            systemToClone.Planets.ToList().ForEach(p => Console.WriteLine(p.Name));
            systemToClone.Moons.ToList().ForEach(m => Console.WriteLine(m.Name));
            systemToClone.Asteroids.ToList().ForEach(a => Console.WriteLine(a.Name));
            systemToClone.ArtificialObjects.ToList().ForEach(art => Console.WriteLine(art.Name));
            Console.WriteLine();
            Console.WriteLine(clone.Name);
            Console.WriteLine(clone.Star.Name);
            clone.Planets.ToList().ForEach(p => Console.WriteLine(p.Name));
            clone.Moons.ToList().ForEach(m => Console.WriteLine(m.Name));
            clone.Asteroids.ToList().ForEach(a => Console.WriteLine(a.Name));
            clone.ArtificialObjects.ToList().ForEach(art => Console.WriteLine(art.Name));
        }
コード例 #2
0
 private void Restore()
 {
     currentPlanetarySystem = backupPlanetarySystem.Clone();
 }
コード例 #3
0
 private void Backup()
 {
     backupPlanetarySystem = currentPlanetarySystem.Clone();
 }