This seems to be quite simple but I can't seem to figure out the problem
public static string destinationFile;
[STAThread]
private static void Main(string[] args)
{
//doing something and then calling convert method
}
private static void convert(object source, FileSystemEventArgs f)
{
if (check(FileName))
{
//doing something
XmlTextWriter myWriter = new XmlTextWriter(destinationFile, null);
//doing something
}
}
private static bool check(string filename)
{
//check the file and return a boolean result
if (sometest)
{
destinationFile = @"d:/GS";
return true;
}
return false;
}
When I run this I get:
The process failed:
System.UnauthorizedAccessException: Access to the path is denied
May I know where I'm going wrong.