System.IO.Abstractions.FileBase.Exists C# (CSharp) Method

Exists() public abstract method

Determines whether the specified file exists.

The Exists method should not be used for path validation, this method merely checks if the file specified in path exists. Passing an invalid path to Exists returns .

Be aware that another process can potentially do something with the file in between the time you call the Exists method and perform another operation on the file, such as Delete.

The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see DirectoryBase.GetCurrentDirectory.

If path describes a directory, this method returns . Trailing spaces are removed from the path parameter before determining if the file exists.

The Exists method returns if any error occurs while trying to determine if the specified file exists. This can occur in situations that raise exceptions such as passing a file name with invalid characters or too many characters a failing or missing disk, or if the caller does not have permission to read the file.

public abstract Exists ( string path ) : bool
path string The file to check.
return bool
        public abstract bool Exists(string path);
        public abstract FileSecurity GetAccessControl(string path);