Where to save your WinForms App data?


The best place to save your application's data wold be in:
Application.LocalUserAppDataPath 
or
Application.UserAppDataPath


string DataPath
{
    get
    {
        try
        {
            string dataFolder = Path.Combine(Application.LocalUserAppDataPath,"data");
            if (!Directory.Exists(dataFolder))
                Directory.CreateDirectory(dataFolder);
            return dataFolder;
        }
        catch { }
        return null;
    }
}

Comments