DimonSmart.IndentedStringBuilder 1.25311.1119

Prefix Reserved
dotnet add package DimonSmart.IndentedStringBuilder --version 1.25311.1119                
NuGet\Install-Package DimonSmart.IndentedStringBuilder -Version 1.25311.1119                
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.25311.1119" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DimonSmart.IndentedStringBuilder --version 1.25311.1119                
#r "nuget: DimonSmart.IndentedStringBuilder, 1.25311.1119"                
#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.25311.1119

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

IndentedStringBuilder

This package is a wrapper around StringBuilder, designed to simplify the creation of indented text (such as code).
Check out the usage examples � it�s easy to understand!

Features

  • Automatic Indentation with using: Simply wrap an indented block in a using statement.
  • Configurable Settings: Customize the initial indent, indent size, and StringBuilder capacity.
  • Customizable Brackets: Define your own bracket style for indented blocks.
  • Multi-line Support: Automatically indent each line of a multi-line string.
  • Scoped Indentation: Supports nested indentation blocks.

Installation

Install the package via the .NET CLI:

dotnet add package DimonSmart.IndentedStringBuilder

Usage

Minimal example of the IndentedStringBuilder usage:

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 option 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 (end of using block), at which point the closing bracket is appended and the indentation is decreased.

  • ToString()
    Underling StringBuidler ToString().

Important note about Source Generators

As source generators nugets are very specific you can face some issues while using indenter-package with your source generator nuget. The problem is that the source generator nuget is not able to find the indenter-package Please check the BuilderGenerator project which is using IndentedStringBuilder internally for generated code formatting.

License

This project is licensed under the 0BSD License. Feel free to use code in your projects.

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 143 3/11/2025
1.25310.1557 168 3/10/2025
1.25310.1411 144 3/10/2025