ObjectDumper.NET 4.4.13-pre

ObjectDumper.NET

Version Downloads Buy Me a Coffee

ObjectDumper is a utility which aims to serialize C# objects to string for debugging and logging purposes.

Download and Install ObjectDumper.NET

This library is available on NuGet: https://www.nuget.org/packages/ObjectDumper.NET/ Use the following command to install ObjectDumper using NuGet package manager console:

PM> Install-Package ObjectDumper.NET

You can use this library in any .NET project which is compatible to PCL (e.g. Xamarin Android, iOS, Windows Phone, Windows Store, Universal Apps, etc.)

The Purpose of ObjectDumper

Serialization, the process of converting a complex object to a machine-readable or over-the-wire transmittable string, is a technique often used in software engineering. A well-known serializer is Newtonsoft.JSON which serializes .NET objects to the data representation format JSON.

ObjectDumper.NET provides two excellent ways to visualize in-memory .NET objects:

  • DumpStyle.Console: serialize objects to human-readable strings, often used to write complex C# objects to log files.
  • DumpStyle.CSharp: serialize objects to C# initializer code, which can be used to compile a C# object again.

API Usage

Dumping C# Objects to Console.WriteLine

The following sample program uses DumpStyle.Console to write C# objects to the console output:

static void Main(string[] args)
{
    var persons = new List<Person>
    {
        new Person { Name = "John", Age = 20, },
        new Person { Name = "Thomas", Age = 30, },
    };

    var personsDump = ObjectDumper.Dump(persons);

    Console.WriteLine(personsDump);
    Console.ReadLine();
}

//CONSOLE OUTPUT:
{ObjectDumperSample.Netfx.Person}
  Name: "John"
  Age: 20
{ObjectDumperSample.Netfx.Person}
  Name: "Thomas"
  Age: 30

Dumping C# initializer code from in-memory objects to Console.WriteLine

The following sample program uses DumpStyle.CSharp to write C# initializer code from in-memory to the console output:

static void Main(string[] args)
{
    var persons = new List<Person>
    {
        new Person { Name = "John", Age = 20, },
        new Person { Name = "Thomas", Age = 30, },
    };

    var personsDump = ObjectDumper.Dump(persons, DumpStyle.CSharp);

    Console.WriteLine(personsDump);
    Console.ReadLine();
}

//CONSOLE OUTPUT:
var listOfPersons = new List<Person>
{
  new Person
  {
    Name = "John",
    Age = 20
  },
  new Person
  {
    Name = "Thomas",
    Age = 30
  }
};

Strong-named assembly

This assembly is signed with the key ObjectDumper.snk in this repository.

Public key (hash algorithm: sha1):

00240000048000009400000006020000002400005253413100040000010001008da06ec8c6bd242c52102a9fc293b7af32f183da0d069f7c9522f063cacc3cc584668dfd6cf0560577380822b0c46fdb19e44fc78fad5e8d15b2c24a8766e2769c942705442926b3dcce385eac263893a4b6916976324544792ba1fb4697ab0d1bf28f3c8f0512234fa0a7b732141f7dc4b4a340bdaa95a6c1460c6a699e65c3

Public key token is fcc359471136d8b8.

In order to get these values, run following commands:

  • Extract public key of snk: sn -p ObjectDumper.snk public.key
  • Display public key: sn -tp public.key

License

This project is offered under a dual license:

  • Free for non-commercial use, including private and educational purposes.
  • Commercial use requires a license, please support the project by making a one-time donation of $50+ via https://buymeacoffee.com/thomasgalliker.

Recurring or more generous sponsorships are sincerely appreciated and help sustain ongoing development. Thank you for your support! If you have any questions about licensing, feel free to contact Thomas Galliker.

No packages depend on ObjectDumper.NET.

4.4

  • Support for nullable reference types.

4.3

  • Maintenance updates.

4.2

  • Bug fix for circular references in collections.
  • Internal refactoring to handle collection dumping more efficiently.
  • Print element count for IEnumerables for DumpStyle.Console.

4.1

  • Raise minimum .NET framework version from net45 to net48.
  • Remove support for net5.0.
  • Bug fix for constructorless record types.

4.0

  • Add support for C# record types.
  • Add assembly strong-naming.

3.4

  • Improve circular reference detection.

3.3

  • Bug fix for generic default value creation.
  • Bug fix for anonymous object dumping.

3.2

  • New versioning schema.

3.1

  • Add support for dumping anonymous types.
  • Add support for .NET 5.
  • Detect circular references for hash combinations h(value, type).
  • Dump warning for circular references.
  • Performance improvement for property dumps.

3.0

  • New formatting logic for DumpStyle.Console (default).
  • Bug fix for dumping decimal numbers in different cultures.
  • Dump MinValue, MaxValue for built-in types (where available).

2.5

  • Handle CultureInfo formatting.
  • Extend GetFormattedName to handle nested generics and multi-dimensional arrays.
  • Optimize variable naming for generic types.

2.4

  • Handle Guid formatting.
  • Handle DateTimeOffset formatting.
  • Handle TimeSpan formatting.
  • Set LineBreakChar default to Environment.NewLine.

2.3

  • Fix escape sequences in string values.

2.2

  • Add bool property DumpOptions.IgnoreDefaultValues to filter properties which contain default values.
  • Refactor namespaces: Move ObjectDumper to root namespace.
  • Add support for netstandard2.0.

2.0

  • Migration to netstandard1.2.
  • Bug fixes.

1.0

  • Initial release.
  • Bugfix for .NET Standard: CSharp initializer code generation for KeyValuePairs is currently disabled in this release.
  • Change DateTime formatting to ISO 8601 standard.
  • Add formatting for IDictionary&lt;TKey, TValue&gt; and KeyValuePair&lt;TKey, TValue&gt;.
  • Replace long suffix 'l' with 'L'.
  • Optimization for DateTime.MinValue and DateTime.MaxValue serialization.
  • Bug fix: Use default dump options if not specified.
  • Add support for .NET Standard.
  • Add DumpOptions several serialization options, e.g. C#-like DumpStyle.
  • Bug fix: Filter COM objects.
  • Bug fix: Catch exceptions if properties/fields cannot be accessed.
  • Bug fix: Ignore non-public properties.

.NET Framework 4.8

  • No dependencies.

.NET 8.0

  • No dependencies.

.NET 9.0

  • No dependencies.

.NET Standard 1.2

.NET Standard 2.0

  • No dependencies.

.NET Standard 2.1

  • No dependencies.

Version Downloads Last updated
4.4.13-pre 13 09/02/2026
4.4.11-pre 10 09/02/2026
4.4.10-pre 11 09/02/2026
4.4.8-pre 11 09/02/2026
4.4.7-pre 9 09/02/2026
4.4.6-pre 7 09/10/2026
4.4.5-pre 8 09/09/2026
4.4.3-pre 7 09/09/2026
4.4.1-pre 7 09/10/2026
4.3.4-pre 10 09/02/2026
4.3.2 8 09/08/2026
4.3.1-pre 8 09/02/2026
4.3.0-pre 7 09/02/2026
4.2.7 10 09/02/2026
4.2.6-pre 9 09/08/2026
4.2.2-pre 11 09/02/2026
4.2.1-pre 11 09/02/2026
4.1.17 10 09/02/2026
4.1.16-pre 10 09/02/2026
4.1.15 11 09/02/2026
4.1.13-pre 10 09/02/2026
4.1.12-pre 10 09/02/2026
4.1.11-pre 6 09/09/2026
4.1.6-pre 7 09/09/2026
4.1.4-pre 7 09/09/2026
4.1.3 9 09/11/2026
4.1.2-pre 7 09/10/2026
4.1.1-pre 7 09/09/2026
4.0.6 11 09/02/2026
4.0.5-pre 10 09/02/2026
4.0.4-pre 11 09/02/2026
4.0.3-pre 10 09/02/2026
3.5.6 12 09/02/2026
3.5.5-pre 11 09/02/2026
3.5.3-pre 11 09/02/2026
3.5.2 10 09/02/2026
3.5.1-pre 7 09/02/2026
3.4.6 14 09/02/2026
3.4.5-pre 10 09/02/2026
3.4.1-pre 10 09/02/2026
3.3.25-pre 9 09/10/2026
3.3.23-pre 10 09/08/2026
3.3.22-pre 6 09/08/2026
3.3.20 8 09/08/2026
3.3.19-pre 9 09/03/2026
3.3.18-pre 11 09/02/2026
3.3.16-pre 8 09/09/2026
3.3.15-pre 7 09/09/2026
3.3.13 8 09/10/2026
3.3.12-pre 7 09/09/2026
3.3.11-pre 7 09/10/2026
3.3.10-pre 7 09/09/2026
3.3.7 9 09/10/2026
3.3.6-pre 7 09/10/2026
3.3.5-pre 8 09/10/2026
3.3.4-pre 8 09/09/2026
3.3.3-pre 8 09/11/2026
3.3.2-pre 8 09/10/2026
3.2.1-pre 11 09/02/2026
3.1.21178.1 11 09/02/2026
3.1.21144.2-pre 10 09/02/2026
3.1.21143.2-pre 9 09/02/2026
3.1.21142.1-pre 10 09/02/2026
3.0.20251.2-pre 7 09/10/2026
3.0.20251.1 11 09/10/2026
3.0.20243.2-pre 7 09/10/2026
3.0.20243.1-pre 5 09/17/2026
3.0.20235.2-pre 6 09/10/2026
3.0.20235.1-pre 6 09/10/2026
3.0.20232.1-pre 7 09/09/2026
3.0.20229.11-pre 8 09/11/2026
3.0.20229.6-pre 8 09/10/2026
3.0.20229.3-pre 12 09/09/2026
3.0.20228.2-pre 6 09/10/2026
3.0.20228.1-pre 6 09/10/2026
2.5.20228.1 10 09/02/2026
2.5.20158.1-pre 11 09/02/2026
2.5.20155.1 11 09/02/2026
2.5.20143.3-pre 12 09/02/2026
2.5.20131.1-pre 9 09/02/2026
2.5.20033.1 8 09/10/2026
2.5.20023.4-pre 9 09/09/2026
2.5.20023.3-pre 7 09/09/2026
2.5.20023.1-pre 7 09/11/2026
2.4.20008.4-pre 11 09/02/2026
2.4.20008.1 11 09/02/2026
2.4.20007.2-pre 9 09/02/2026
2.4.19323.7-pre 11 09/02/2026
2.4.19323.6-pre 12 09/02/2026
2.4.19323.4-pre 9 09/02/2026
2.4.19292.2-pre 8 09/02/2026
2.4.19292.1-pre 11 09/02/2026
2.4.19286.1-pre 9 09/02/2026
2.4.19218.1 6 09/11/2026
2.4.19204.1-pre 7 09/09/2026
2.4.19166.1 7 09/11/2026
2.4.19138.1 9 09/10/2026
2.4.19119.1-pre 9 09/09/2026
2.3.19050.6 11 09/02/2026
2.3.19050.4-pre 9 09/02/2026
2.3.19050.3-pre 9 09/02/2026
2.3.19049.4-pre 7 09/10/2026
2.3.19046.3 12 09/02/2026
2.3.19046.1-pre 10 09/10/2026
2.2.19044.3-pre 7 09/10/2026
2.2.19021.1 8 09/10/2026
2.2.19011.1 8 09/09/2026
2.2.19007.1 8 09/02/2026
2.1.18332.7 8 09/10/2026
2.0.18317.1 8 09/02/2026
2.0.18311.1 9 09/02/2026
2.0.18282.1 11 09/02/2026
1.0.7 11 09/02/2026
1.0.6 9 09/02/2026
1.0.4 12 09/02/2026
1.0.3 9 09/02/2026
1.0.2 11 09/02/2026
1.0.1 8 09/11/2026
1.0.0 7 09/10/2026