using System; namespace PingPong.GameEngine.Components { public class Player : IScorable { #region Members /// /// The name. /// private Lazy name; /// /// The score. /// private Lazy score; #endregion #region Properties /// /// Gets the name. /// /// /// The name. /// public string Name { get { return this.name.Value; } } #endregion #region Constructors /// /// Initializes a new instance of the class. /// public Player() { this.name = new Lazy(() => string.Empty); this.score = new Lazy(() => new Score()); } #endregion #region Methods /// /// Sets the name. /// /// /// The name. /// /// /// Name. /// public Player SetName(string name) { this.name = new Lazy(() => name); return this; } #endregion #region Implementation of IScorable /// /// Gets the score. /// /// /// The score. /// public Score Score { get { return this.score.Value; } } /// /// Sets the score. /// /// /// The score. /// /// /// Score. /// public Player SetScore(Score score) { if (score == null) { throw new ArgumentNullException("score"); } this.score = new Lazy(() => score); return this; } #endregion } }