Say you have a winform application in visual studio. Go to "Project Properties"> "Application" tab> "Enter output type:" in the console application.
Now, when you start your winform, the console application lights up in the background. You can write this console application with standard output. For instance.
private void button1_Click(object sender, EventArgs e) { Console.WriteLine("Hello World"); }
source share