Friday, August 15, 2008

"Cool C# sample that's probably on your hard drive yet you may have never seen" of the day - ObjectDumper.CS

Eric White's Blog - Object Dumper: An Invaluable Tool for Writing Code in the Functional Programming Style

"When developing C# programs in the functional programming style, you often need to dump out a collection to the console. Object dumper is a great tool to use for this. It is a sample that far too few developers know about.

...

To use it, just add ObjectDumper.cs to your project.

For the simplest use, you can simply pass any object to ObjectDumper:

var z = new

    {

        A = "1",

        B = "2"

    };

 

ObjectDumper.Write(z);

This produces the following output:

A=1 B=2

..."

Nice. Not quite as cool as the LINQPad .Dump(), but still pretty useful when you need to [juvenal humor deleted]. And at least this one you have the source for... :)

This can be found in (at least on my machine) "C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033\CSharpSamples.zip" in the "\LinqSamples\ObjectDumper\" folder.

No comments:

Post a Comment

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...