public PctbxMemento(List<Ball> balls) { this.balls = new List<BallMemento>(); foreach (var ball in balls) { var ballMemento = new BallMemento { x = ball.X, y = ball.Y, increaseX = ball.IncreaseX, increaseY = ball.IncreaseY }; this.balls.Add(ballMemento); } }
} // for xml serialization public PctbxMemento(List <Ball> balls) { this.balls = new List <BallMemento>(); foreach (var ball in balls) { var ballMemento = new BallMemento { x = ball.X, y = ball.Y, increaseX = ball.IncreaseX, increaseY = ball.IncreaseY }; this.balls.Add(ballMemento); } }