Ejemplo n.º 1
0
        private IDisposable CreateRevertScope()
        {
            revertInProgress = true;
            var stub = new StubDisposable {
                Dispose = () => revertInProgress = false
            };

            return(stub);
        }
Ejemplo n.º 2
0
        protected static IDisposable Scope <T>(ref T field, T value, Action <T> lambda)
        {
            var originalValue = field;
            var disposable    = new StubDisposable {
                Dispose = () => lambda(originalValue)
            };

            field = value;
            return(disposable);
        }