Хранитель (шаблон проектирования): различия между версиями

[непроверенная версия][непроверенная версия]
Содержимое удалено Содержимое добавлено
добавление модификатора final в memento
→‎C#: Memento instance is meant to be returned from GetMemento method and not a Foo instance.
Строка 400:
object IOriginator.GetMemento()
{
return new FooMemento { StringProperty = this.StringProperty, IntProperty = this.IntProperty };
 
}
Строка 408:
if (Object.ReferenceEquals(memento, null))
throw new ArgumentNullException("memento");
if (!(memento is FooMemento))
throw new ArgumentException("memento");
StringProperty = ((Memento)memento).StringProperty;
IntProperty = ((FooMemento)memento).IntProperty;
}