Skip to content

Adding `.Dump()` extension methods to Console Applications, similar to LinqPad's.

License

Notifications You must be signed in to change notification settings

LognormalSolutionsInc/Dumpify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dumpify

Improve productivity and debuggability by adding .Dump() extension methods to Console Applications. Dump any object in a structured and colorful way into the Console, Trace, Debug events or your own custom output.

One of my favorites LinqPad feature is its .Dump() extension methods and how customizable they are. It was always hard to return to Visual Studio, VSCode, Rider, or any other IDE/Editor and find out this feature doesn't exist there.

How to Install

The library is published as a Nuget Either run dotnet add package Dumpify, Install-Package Dumpify or use Visual Studio's NuGet Package Manager

Features

  • Dump any object in a structured, colorful way to Console, Debug, Trace or any other custom output
  • Support Properties, Fields and non-public members
  • Support max nesting levels
  • Support circular dependencies and references
  • Support styling and customizations
  • Highly Configurable
  • Fast!
  • Support for differnt otuput target:
    • Console
    • Trace
    • Debug
    • Text
    • Custom

Examples:

new { Name = "Dumpify", Description = "Dump any object to Console" }.Dump();

image

Support nesting as well

var moaid = new Person { FirstName = "Moaid", LastName = "Hathot" };
var haneeni = new Person { FirstName = "Haneeni", LastName = "Shibli" };

moaid.Spouse = haneeni;
haneeni.Spouse = moaid;

moaid.Dump();

image

Support for special types like arrays and Dictionaries

var arr = new[] { 1, 2, 3, 4 }.Dump();

image

var arr2d = new int[,] { {1, 2}, {3, 4} }.Dump();

image

new Dictionary<string, string>
{
   ["Moaid"] = "Hathot",
   ["Haneeni"] = "Shibli",
   ["Eren"] = "Yeager",
   ["Mikasa"] = "Ackerman",
}.Dump();

image

Features for the future 0.6.0 release

  • Add configuration for formatting Anonymous Objects type names
  • Cache Spectre.Console styles and colors
  • Text renderer
  • Consider disabling wrapping of Table titles
  • re-introduce labels
  • Better styling of Custom values
    • Typeof(T) for example, Generic types, etc.
  • Better rendering of Delegates

To do

  • Live outputs
  • Add custom rendering for more types:
    • DataTable & DataSets
    • Exceptions, AggregateExceptions, etc...
  • Rethink Generators caching keys
  • Consider using Max Depth for Descriptors
  • Refactor Renderers and make it better extendable
  • Add more renderers
    • Text Renderers
    • re-introduce Json
    • CSharp Renderer
  • Consider Decoupling from Spectre.Console
  • Tests
    • More tests
    • Visual (Render) Tests - consider acceptance tests
    • Tests for Nesting
  • More sync between Custom Descriptors and Custom Renderers
    • Think how we can mark type's descriptor as needing special rendering.
    • The current CustomDescriptorGenerator must generate a value
    • Consider ValueTuple
  • Refactor SpectureTableRenderer to share customization code
  • Consider changing the style/view of ObjectDescriptors without properties (currently empty table)

About

Adding `.Dump()` extension methods to Console Applications, similar to LinqPad's.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%