Verify path is directory or file

By Super Man

here i am showing how to check whether the path is file or directory

string path=@"C:\Desktop";
            
            if (System.IO.Directory.Exists(path))

             {
                 MessageBox.Show("Directory");

             }
              if(System.IO.File.Exists(path))
            {
                 MessageBox.Show("File");
            }

Verify path is directory or file  (1416 Views)