Skip to content

Pretty print objects to the console. Similar to LINQPad's Dump() extension method.

License

Notifications You must be signed in to change notification settings

modulexcite/ConsoleDump

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ConsoleDump

Visualize your collections and objects in color at the console.

Example output

Console.WriteLine(...) cannot begin to compare to LINQPad's .Dump() extension method. This library provides a .Dump() extension method that can be used in console apps and in scriptcs.

The output above was created with the following code:

new[] { 200, 201, 202, 400, 404 }.Select(CreateSillyExample).Dump();
	
IPAddress.Loopback.Dump(".Dump() output can be labeled.");

Features

  • Available via NuGet: PM> Install-Package ConsoleDump
  • Single dll, depends only on .NET 4.0 Client Profile
  • Output colors based on type:
    • null is green
    • Strings are cyan
    • Primitives, enums and nullable primitives are white
    • .ToString() from a class is purple
    • .ToString() from a struct is yellow
    • If a property throws an exception the exception is shown in red
  • Numbers are right aligned
  • IEnumerable<> support
    • Displays count (if available)
    • Safe for infinite IEnumerable<>
    • Only the first 24 items are displayed
  • Much more concise and readable than JSON in the console

Disclaimer

This project is not affiliated with LINQPad or its author Joseph Albahari. I've been completely spoiled by an amazing tool and I am trying to keep some of the convenience when working at the console. Download LINQPad, it's free; activate autocompletion, it's far and away the best .NET tool.

TODO

  • Improve this document
  • Improve "count" wording on enumerable views
  • Refine colors
  • Truncate long strings
  • Truncate or omit columns if IEnumerable<> view is too wide for screen
  • Investigate scriptcs REPL integration

License

Apache 2

About

Pretty print objects to the console. Similar to LINQPad's Dump() extension method.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%