标签:des style blog io color sp div log bs
void Main() { Product product = new Product{Name="A"}; Director director = new Director(); director.Memento=product.Save(); product.Load(director.Memento); } class Product{ public string Name { get; set; } public Memento Save(){ return new Memento{Name=Name}; } public void Load(Memento m){ Name=m.Name; } } class Memento{ public string Name { get; set; } } class Director{ public Memento Memento { get; set; } }
DesignPattern_Behavioral_Memento
标签:des style blog io color sp div log bs
原文地址:http://www.cnblogs.com/rammderek/p/4102973.html