MementoPattern.Originator.StoreInMemento C# (CSharp) Method

StoreInMemento() public method

public StoreInMemento ( ) : Memento
return Memento
        public Memento StoreInMemento()
        {
            Debug.Log ("From Originator: Saving in Memento: [\"" + this.article + "\"]");
            return new Memento (this.article);
        }

Usage Example

 // these methods below might get called when someone is pressing a button
 // you could easily implement it with unitys new ui system :)
 public void Save(string text)
 {
     originator.Set(text);
     caretaker.Add(originator.StoreInMemento());
     savedFiles     = caretaker.GetCountOfSavedArticles();
     currentArticle = savedFiles;
 }
All Usage Examples Of MementoPattern.Originator::StoreInMemento