Is there a function in C# to tell if a file exists or not?
I was viewing this thread:
Check if a file exists
and it came across me that I didn't know of a function to do this in C#.
you need to use the system.IO library
using System.IO;
string filename = @"filepath"
if (filename.exists)
{
some code
}
It would beOriginally Posted by hoser2001
Code:if (File.Exists(filename)) { }
http://msdn2.microsoft.com/en-us/lib...le.exists.aspx
Jordan!
Thank you very much for correcting me. Sorry for the mishap.
I do that all the time. I'll be thinking one thing and type another. You could tell that was what you meant to type. lol
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks