0

Why is File.Exists not returning true, no matter what filename I feed into it. Here is my code below

using System;

namespace MyNamespace
{
    public class MainClass
        static void Main()
        {
        string filename = "Firefox";
         if(File.Exists(filename)  ){
         Console.WriteLine("true");
         }
          else{Console.WriteLine("False"); }
        }
    }
}

I tried changing filename variable to a directory, and even a different file name but it still returns false. I'm 100% sure that the files are in the directory

Rob
  • 26,989
  • 16
  • 82
  • 98
JackBarn
  • 635
  • 1
  • 6
  • 18

0 Answers0