using System; namespace RosettaUI.UndoSystem { public interface IObjectRestoreRecord { object RestoreObject(); } public interface IObjectRestoreRecord : IObjectRestoreRecord { TObject Restore(); object IObjectRestoreRecord.RestoreObject() => Restore(); } public class ObjectRestoreRecord : IObjectRestoreRecord { private readonly Func _restoreFunc; public ObjectRestoreRecord(Func restoreFunc) { _restoreFunc = restoreFunc; } public TObject Restore() => _restoreFunc != null ? _restoreFunc() : default; } }