ShaderTools.VisualStudio.Tests.Hlsl.Support.BasicUndoHistory.Clear C# (CSharp) Méthode

Clear() private méthode

private Clear ( ) : void
Résultat void
        internal void Clear()
        {
            if (_state != TextUndoHistoryState.Idle || CurrentTransaction != null)
            {
                throw new InvalidOperationException("Can't clear with an open transaction or in undo / redo");
            }

            _undoStack.Clear();
            _redoStack.Clear();

            // The IEditorOperations AddAfterTextBufferChangePrimitive and AddBeforeTextBufferChangePrimitive
            // implementations store an ITextView in the Property of the associated ITextUndoHistory.  It's
            // necessary to keep this value present so long as the primitives are in the undo / redo stack
            // as their implementation depends on it.  Once the stack is cleared we can safely remove 
            // the value.
            //
            // This is in fact necessary for sane testing.  Without this removal it's impossible to have 
            // an ITextView disconnect and be collected from it's underlying ITextBuffer.  The ITextUndoHistory
            // is associated with an ITextBuffer and through it's undo stack will keep the ITextView alive
            // indefinitely
            _properties.RemoveProperty(typeof(ITextView));
        }