/// <summary> /// Creates and returns an disposable ExpectingScope object. This is intended to be used with a using block. /// </summary> /// <returns>An ExpectingScope instance.</returns> /// <exception cref="InvalidOperationException"> /// Throws if you already have an un-disposed ExpectingScope from this logger. /// </exception> public ExpectingScope EnterExpectingScope() { if (currentExpectingScope != null) { throw new InvalidOperationException( "Cannot enter an ExpectingScope while there is an outstanding ExpectingScope"); } currentExpectingScope = new ExpectingScope(this); return(currentExpectingScope); }
public void Dispose() { currentExpectingScope = null; }