I have the test.XML file in my D drive. when I attempt to run this code, it skips the condition despite the fact that record exists in my Disk. I had a go at evaluating the File extension moreover. I can't go inside the IF condition. could anybody offer assistance?ne help?
if(File.Exists(@"D:\\test.xml"))
{
..
..
}
You missed the \\
, as backslash is escape sequence you have to use an extra back slash in
path
if(File.Exist("D:\\test.xml"))
{
..
..
}
You can also use verbatim string
if(File.Exist(@"D:\test.xml"))
{
..
..
}
Edit Based on comments
Use either \\
to escape the backslash in path or verbatim string, you are using both
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.