I am working on a C# WPF app and I make a folder with the following code:
public MainWindow()
{
InitializeComponent();
string path = @"C:\Users\MyName\Documents\TestFolder";
if (!Directory.Exists(path))
{
// Try to create the directory.
Directory.CreateDirectory(path);
}
}
As you can see I currently have it in the initialization of my mainwindow. Is there a better place for this and other code you want to execute during startup of a WPF app?