GithubHelp home page GithubHelp logo

modulexcite / consoledump Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cameronism/consoledump

0.0 1.0 0.0 196 KB

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

License: Apache License 2.0

C# 100.00%

consoledump's Introduction

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

consoledump's People

Contributors

cameronism avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.