I am using a .txt file to save data in a Windows Forms Application. The .txt is located at the same folder as the .exe. However, if I launch the app via shortcut (let's say a desktop shortcut), the app will save the .txt file in the desktop (even though the actual .exe is located somewhere else). The code I use is:
var myFile = File.Create(@"data.txt");
using (var sw = new StreamWriter(@"data.txt", true))
{
sw.WriteLine("I like apples.");
}