Skip to content

BlockScope

Disposable scope that manages code block indentation. Opens a block on creation and closes it on disposal.

C# Signature
internal readonly struct BlockScope : System.IDisposable

Creates a new block scope that opens a code block and increments the indentation.

C# Signature
public BlockScope(CodeWriter writer, bool newLineOnDispose = false);

The code writer to write to.

If true, a newline will be inserted when the block scope is disposed.

Closes the code block and decrements the indentation.

C# Signature
public void Dispose();