It would be handy during debugging to have multiple consoles (not multiple monitors, which I already have). I am imagining something like Console.WriteLine(1, String1) which would send String1 to one console window 1 and Console.WriteLine(2, String2) which would send String2 to console window 2.
Write is used to print data without printing the new line, while Console. WriteLine is used to print data along with printing the new line.
WriteLine(String, Object, Object) Writes the text representation of the specified objects, followed by the current line terminator, to the standard output stream using the specified format information.
Try using System. Diagnostics. Debug. WriteLine("This is a log"); and in Visual Studio open View and then in Output you will see the log when running your application.
Nope
A process can be associated with only one console, so the AllocConsole function fails if the calling process already has a console. A process can use the FreeConsole function to detach itself from its current console, then it can call AllocConsole to create a new console or AttachConsole to attach to another console.
[http://msdn.microsoft.com/en-us/library/ms681944(VS.85).aspx](http://msdn.microsoft.com/en-us/library/ms681944(VS.85).aspx)
Instead you can use WinForms or WPF to create multiple "console" windows and write a simple WriteLine
method to append text to a text box or similar.
Another option is to open a log file, and use that as your second "console".
No. The Console class is just a very thin wrapper around the Win32 idea of a console. Essentially everything you see when you use
cmd.exe
. There is no way to create 2 of these in a single process.
Yes. It would be possible to essentially build a very console like class in WPF or WinForms. Use that to spit out text to a command line like application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With