public IFigure CloneFigure(ExternalizableFilter filter) { var persister = new Externalizer(); var mem = persister.Save(this, filter); return(persister.Load(mem, null) as IFigure); }
// ======================================== // constructor // ======================================== internal ExternalizeContext( Externalizer owner, ExternalizableFilter externalizableFilter, MementoFilter mementoFilter ) { _owner = owner; _externalizableFilter = externalizableFilter; _mementoFilter = mementoFilter; }
// ======================================== // method // ======================================== // --- save --- public IMemento Save(object externalizable, ExternalizableFilter externalizableFilter) { var context = new ExternalizeContext(this, externalizableFilter, null); return(context.CreateMemento(externalizable)); }