C# write file to MyDocuments
Using class System.Environment you can get paths of special Windows folders such as Program Files, My Documents and others. The list of available values is stored in enum object Environment.SpecialFolder (Fugure 1).
The code for receiving and using of My Documents folder path is below. The program writes file in My Documents folder and reads it.
static void Main(string[] args)
{
string myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string filename = Path.Combine(myDocuments, "helloworld.txt");
File.WriteAllText(filename, "Hello world");
string content = File.ReadAllText(filename);
Console.WriteLine(content);
}


Azure.RequestFailedException when start App in Visual Studio
Determine the first and last days of a quarter with Day.js
Login as another user in SharePoint 2019 on-premises site in Chrome