Skip to content

Instantly share code, notes, and snippets.

@gfraiteur
Last active October 8, 2021 07:07
Show Gist options
  • Save gfraiteur/f403e9847858eb251016da5c095166b2 to your computer and use it in GitHub Desktop.
Save gfraiteur/f403e9847858eb251016da5c095166b2 to your computer and use it in GitHub Desktop.
AppendProlog
/// <summary>
/// Appends the indent string, context description, and the record kind to the current <see cref="StringBuilder"/>.
/// </summary>
protected virtual void AppendProlog()
{
#if DEBUG
if ( this.StringBuilder != this.actionStringBuilder )
throw new AssertionFailedException();
#endif
this.AppendIndentString();
int lengthBefore = this.StringBuilder.Length;
this.AppendContextDescription();
if ( this.StringBuilder.Length > lengthBefore )
{
this.AppendDelimiter();
}
if ( this.HasRecordKindName() )
{
this.AppendRecordKind();
this.RequirePunctuation( ':' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment