What is difference between File.Exists(“”) and FileInfo exists

后端 未结 6 1374
萌比男神i
萌比男神i 2021-02-13 22:27

I have an *.exe file in \\ProgramFiles(x86)\\MyAppFolder.

In x86 application I check if the file exists (64 bit system). simple:

bool fileExists = File.E         


        
6条回答
  •  我在风中等你
    2021-02-13 22:36

    in your first case, the file path is incorrect, you need spaces in "Program Files (x86)".

    Secondly, the Path.Combine will return a Directory path so you'll end up with something like "C:\Program Files (x86)\MyAppFolder\Manager.exe\" so it's a bad idea.

    Both methods work the same way, so make sure you check that the path is correct.

提交回复
热议问题