views:

372

answers:

4

Looking at this LINQ demo:

LINQ Framework Overview

When going in debug mode, the output have colors in it. I'm using the same ObjectDumper class and I only have the black/white console window.

How can I have the same results in the console window?

Thanks

A: 

You can set colors of the console text and/or background in the properties if that's what you're looking for... Just right click the title bar, click Properties and choose desired colors.

Mr. Brownstone
The output have different colors in it.Name=Mr. BrownstoneName= is in blueMr. Brownstone is in green...
vIceBerg
A: 

If you want to control this programmatically, use the System.Console.ForegroundColor property.

http://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx

Drew Noakes
+2  A: 

What about :

 Console.ForegroundColor = ConsoleColor.Yellow;
 Console.BackgroundColor = ConsoleColor.DarkRed;
 Console.WriteLine("Test");
Daok
Did you look at the video, his fieldnames are one color and the values in the fields are an other, I don't beleive he switchs back and forth all the time, hmmm very good question indeed.
CheGueVerra
A: 

Daok have what you want...

But you can always use Win32 calls.

[DllImport("kernel32.dll")] public static extern bool SetConsoleTextAttribute(IntPtr hConsoleOutput, int wAttributes);
[DllImport("kernel32.dll")] public static extern IntPtr GetStdHandle(uint nStdHandle);
Mister Dev