Determining if an XDocument File Exists

Posted by tkeE2036 on Stack Overflow See other posts from Stack Overflow or by tkeE2036
Published on 2010-03-09T00:13:15Z Indexed on 2010/03/09 0:21 UTC
Read the original article Hit count: 665

Filed under:
|
|

Hello Everyone,

I am using LINQ and I was wondering what is the best way to create an XDocument and then check to make sure that the XDocument actually exists, much like File.Exists?

String fileLoc = "path/to/file";
XDocument doc = new XDocument(fileLoc);
//Now I want to check to see if this file exists

Is there a way to do this?

Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ