Often it is very useful to have a console besides the winform/wpf application. And its really easy to :)
Create an available class:
using System;
using System.Runtime.InteropServices;
public static class ConsoleEx
{
/// <summary>
/// Shows the Console
/// </summary>
[DllImport("kernel32.dll")]
public static extern Boolean AllocConsole();
/// <summary>
/// Hides the Console
/// </summary>
[DllImport("kernel32.dll")]
public static extern Boolean FreeConsole();
}
I then use it like this in my Code (WPF App):
public partial class App : Application
{
public App(){
#if DEBUG
ConsoleEx.AllocConsole();
#endif
}
}
You could use this with a Linq DataContext:
MyDataContext.Log = Console.Out;