Skip to content

Instantly share code, notes, and snippets.

@EdCharbeneau
Created March 22, 2022 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdCharbeneau/43e397cf19234ffe1fa02d909c93f19e to your computer and use it in GitHub Desktop.
Save EdCharbeneau/43e397cf19234ffe1fa02d909c93f19e to your computer and use it in GitHub Desktop.
String Builder cleanup
public static class StringBuilderExtensions {
public static StringBuilder AppendWhen(this StringBuilder sb, string value, bool predicate) {
if(predicate) {
sb.Append(value);
}
return sb;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment