/// <summary> /// Get a backup of the memory manager. /// </summary> /// <returns>A disposable backup that auto-restores when not forgotten.</returns> public static Backup GetBackup() { var backup = new Backup(SINGLETON); // Force creating a new instance when Instance is called. SINGLETON = null; return(backup); }
/// <summary> /// Forget any backup so that Dispose doesn't use it. /// </summary> public void Forget() { m_instance = null; }
public Backup(MyMemoryManager instance) { m_instance = instance; }