/// <summary> /// Returns a value indicating whether the specified path refers to an existing file. /// </summary> /// <param name="path"> /// A <see cref="String"/> containing the path to check. /// </param> /// <returns> /// <see langword="true"/> if <paramref name="path"/> refers to an existing file; /// otherwise, <see langword="false"/>. /// </returns> /// <remarks> /// Note that this method will return false if any error occurs while trying to determine /// if the specified file exists. This includes situations that would normally result in /// thrown exceptions including (but not limited to); passing in a file name with invalid /// or too many characters, an I/O error such as a failing or missing disk, or if the caller /// does not have Windows or Code Access Security (CAS) permissions to to read the file. /// </remarks> public static bool Exists(string path) { if (Common.IsRunningOnMono() && Common.IsPlatformUnix()) { return(SysFile.Exists(path)); } bool isDirectory; if (Common.Exists(path, out isDirectory)) { return(!isDirectory); } return(false); }