I’m creating a StreamWriter using a relative path. But the file doesn’t appear. To troubleshoot, I want to check that the full path is what I’m expecting. So having a StreamWriter instance, how can I get the full path of the file it’s going to write to?
string fileName = "relative/path.txt"
StreamWriter sw= new StreamWriter(fileName);
// What is the full path of 'sw'?
To get the full path from a relative path, use the Path.GetFullPath method.
For example: