MicroElements.Formatting.Sources 1.0.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
.NET Standard 2.1
dotnet add package MicroElements.Formatting.Sources --version 1.0.1
NuGet\Install-Package MicroElements.Formatting.Sources -Version 1.0.1
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="MicroElements.Formatting.Sources" Version="1.0.1">
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MicroElements.Formatting.Sources --version 1.0.1
#r "nuget: MicroElements.Formatting.Sources, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MicroElements.Formatting.Sources as a Cake Addin
#addin nuget:?package=MicroElements.Formatting.Sources&version=1.0.1

// Install MicroElements.Formatting.Sources as a Cake Tool
#tool nuget:?package=MicroElements.Formatting.Sources&version=1.0.1


MicroElements source only package: Formatting.

Source only package does not forces binary reference on it. Just add package and use as code.


FormatValue formats numbers with invariant culture, date types in ISO formats, for collections uses FormatAsTuple

FormatAsTuple formats collections using arguments:

  • separator: The value that uses to separate items. DefaultValue = ", "
  • nullPlaceholder: The value that renders if item is null. DefaultValue = "null"
  • startSymbol: Start symbol. DefaultValue = '('.
  • endSymbol: End symbol. DefaultValue = ')'.
  • formatValue: Func that formats object value to string representation. By default uses FormatValue.
  • maxItems: The max number of items that will be formatted. By default not limited.
  • maxTextLength: Max result text length. Used to limit result text size. DefaultValue=1024
  • trimmedPlaceholder: The value that replaces trimmed part of sequence. DefaultValue = "..."


new[] { 1, 2 }.FormatAsTuple().Should().Be("(1, 2)");
new[] { 1.1, 2.5 }.FormatAsTuple().Should().Be("(1.1, 2.5)");

new[] { new DateTime(2021, 06, 22), new DateTime(2021, 06, 22, 13, 52, 49, 123)}
   .FormatAsTuple().Should().Be("(2021-06-22, 2021-06-22T13:52:49)");

Enumerable.Range(1, 100)
   .FormatAsTuple(maxItems: 2)
   .Should().Be("(1, 2, ...)");

Enumerable.Repeat("abcde", 100)
   .FormatAsTuple(maxTextLength: 14)
   .Should().Be("(abcde, ab...)")
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MicroElements.Formatting.Sources:

Package Downloads
MicroElements.Shared.Sources The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

MicroElements source packages metapackage.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 374 12/13/2021
1.0.0 365 11/1/2021