TinyString 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TinyString --version 0.1.0
                    
NuGet\Install-Package TinyString -Version 0.1.0
                    
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="TinyString" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TinyString" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TinyString" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TinyString --version 0.1.0
                    
#r "nuget: TinyString, 0.1.0"
                    
#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.
#:package TinyString@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TinyString&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TinyString&version=0.1.0
                    
Install as a Cake Tool

TinyString

Logo

Turn any .NET object into a readable string. Zero config for simple cases, a clean fluent API when you want more.

dotnet add package TinyString

Zero config

Call .Stringify() on anything:

using TinyString;

var book = new Book { Title = "1984", Author = "George Orwell", Pages = 328 };
book.Stringify();
// → "Book. Title: 1984, Author: George Orwell, Pages: 328"

All public properties, declaration order, class name as header, floats at 2 decimal places. No setup required.


Fluent API

Pass a configuration action when you need more control. Everything lives at the call site — your classes stay clean:

zoo.Stringify(o => o
    .MultiLine()
    .Label("🦁 Zoo")
    .For(x => x.EntrancePrice).Prefix("$").Decimals(0));
🦁 Zoo
Name: Woodland Zoo
EntrancePrice: $15
Animals:
|_ Animal. Name: Mittens, Species: Cat, Weight: 4.50
|_ Animal. Name: Tony, Species: Tiger, Weight: 120.30

In multi-line mode, collections are automatically rendered with |_ per item. In single-line mode they're joined with ", ". No extra configuration needed.


Options

Global

Method What it does Default
.MultiLine() / .SingleLine() Layout style single-line
.Label("…") Replace the class name header class name
.NoLabel() Hide the header entirely
.Separator("…") Between properties in single-line ", "
.CollectionSeparator("…") Override the auto collection separator auto
.Decimals(n) Decimal places for floats 2
.Keys(NamingFormat.X) Key naming style PascalCase

Available naming formats: PascalCase, CamelCase, SnakeCase, KebabCase, HumanCase.

Per property

Chain .For(x => x.Prop) to configure a specific property, then keep chaining .For() to move to the next one:

animal.Stringify(o => o
    .NoLabel()
    .Separator(" ")
    .For(x => x.Name).NoKey()
    .For(x => x.Species).Prefix("(").Suffix(")").NoKey()
    .For(x => x.Weight).NoKey().Suffix("kg").Decimals(2)
    .For(x => x.Age).NoKey().Suffix("yrs")
    .For(x => x.IsRare).Ignore());
// → "Mittens (Cat) 4.50kg 5yrs"
Method What it does
.Ignore() Exclude this property
.As("…") Rename the key
.NoKey() Show only the value
.Prefix("…") / .Suffix("…") Wrap the value
.Separator("…") Collection separator for this property
.Decimals(n) Decimal places for this property

Nested objects

Nested objects are stringified automatically using their own defaults:

var order = new Order { Product = new Product { Name = "Book", Price = 12.99 }, Qty = 2 };
order.Stringify();
// → "Order. Product: Product. Name: Book, Price: 12.99, Qty: 2"

Migrating from the attribute API

Previous versions configured stringification via [Stringify], [StringifyProperty], and [StringifyIgnore] attributes. These still work but are deprecated and will be removed in a future major version. Move the configuration to the .Stringify() call site instead.


MIT License

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 248 3/31/2026
0.1.0 73 3/31/2026
0.0.3 18,456 6/19/2025
0.0.2 210 6/19/2025
0.0.1 218 6/19/2025