Looking at this LINQ demo:
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
From stackoverflow
-
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.
vIceBerg : The output have different colors in it. Name=Mr. Brownstone Name= is in blue Mr. Brownstone is in green... -
If you want to control this programmatically, use the
System.Console.ForegroundColorproperty.http://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx
-
What about :
Console.ForegroundColor = ConsoleColor.Yellow; Console.BackgroundColor = ConsoleColor.DarkRed; Console.WriteLine("Test");CheGueVerra : 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. -
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);
0 comments:
Post a Comment