DimonSmart.IndentedStringBuilder 1.25310.1557

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package DimonSmart.IndentedStringBuilder --version 1.25310.1557                
NuGet\Install-Package DimonSmart.IndentedStringBuilder -Version 1.25310.1557                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DimonSmart.IndentedStringBuilder" Version="1.25310.1557" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DimonSmart.IndentedStringBuilder --version 1.25310.1557                
#r "nuget: DimonSmart.IndentedStringBuilder, 1.25310.1557"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DimonSmart.IndentedStringBuilder as a Cake Addin
#addin nuget:?package=DimonSmart.IndentedStringBuilder&version=1.25310.1557

// Install DimonSmart.IndentedStringBuilder as a Cake Tool
#tool nuget:?package=DimonSmart.IndentedStringBuilder&version=1.25310.1557                

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 returned IDisposable 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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.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