DimonSmart.IndentedStringBuilder
1.25310.1411
Prefix Reserved
See the version list below for details.
dotnet add package DimonSmart.IndentedStringBuilder --version 1.25310.1411
NuGet\Install-Package DimonSmart.IndentedStringBuilder -Version 1.25310.1411
<PackageReference Include="DimonSmart.IndentedStringBuilder" Version="1.25310.1411" />
paket add DimonSmart.IndentedStringBuilder --version 1.25310.1411
#r "nuget: DimonSmart.IndentedStringBuilder, 1.25310.1411"
// Install DimonSmart.IndentedStringBuilder as a Cake Addin #addin nuget:?package=DimonSmart.IndentedStringBuilder&version=1.25310.1411 // Install DimonSmart.IndentedStringBuilder as a Cake Tool #tool nuget:?package=DimonSmart.IndentedStringBuilder&version=1.25310.1411
IndentedStringBuilder
A lightweight and flexible utility for building strings with automatic indentation and customizable formatting. This NuGet package simplifies the generation of indented code blocks, configuration files, or any structured text output.
Features
- Automatic Indentation Management: Easily manage indentation levels when generating multi-line strings.
- Configurable Settings: Customize initial indent, indent size, and capacity.
- Customizable Brackets: Define your own opening and closing brackets for indented blocks.
- Multi-line Support: Optionally indent each line in a multi-line string.
- Scoped Indentation: Utilize disposable indentation blocks to automatically handle indentation scopes.
Installation
Install the package via the .NET CLI:
dotnet add package DimonSmart.IndentedStringBuilder
Usage
Below is a minimal example of how to use the IndentedStringBuilder:
using DimonSmart.IndentedStringBuilder;
var builder = new IndentedStringBuilder();
using (builder.Indent("Block"))
{
builder.AppendLine("Inside");
}
Console.WriteLine(builder.ToString());
This produces the following output:
Block
{
Inside
}
API Overview
AppendLine(string line = "")
Appends a new line with the current indentation. Supports multi-line strings when enabled.Append(string text)
Appends text with the current indentation.Indent(string line, string? openingBracket = null, string? closingBracket = null)
Starts an indented block by appending the given line and an opening bracket. Increases the indentation level until the returnedIDisposable
is disposed, at which point the closing bracket is appended and the indentation is decreased.ToString()
Returns the composed string with all applied indentations and formatting.
License
This project is licensed under the 0BSD License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DimonSmart.IndentedStringBuilder:
Package | Downloads |
---|---|
DimonSmart.BuilderGenerator
Generate builder classes via source generation. Simplifies object creation with Builder pattern. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.25311.1119 | 144 | 12 days ago |
1.25310.1557 | 169 | 13 days ago |
1.25310.1411 | 145 | 13 days ago |