public static bool Exists(string path) { // For security reasons no exceptions are // thrown, only false is returned if there is // any problem with the path or permissions. // Minimizes what information can be // discovered by using this method. if (String.IsNullOrWhiteSpace(path) || path.IndexOfAny(Path.InvalidPathChars) >= 0) { return(false); } // on Moonlight this does not throw but returns false if (!SecurityManager.CheckElevatedPermissions()) { return(false); } MonoIOError error; return(MonoIO.ExistsFile(path, out error)); }