Mono Class Library: System.IO.File Overview | Members

System.IO.File.Exists Method

Returns a bool indicating whether the specified file exists. [Edit]

public static bool Exists (string path)

Parameters

path
A string containing the name of the file to check. [Edit]

Returns

true if the caller has the required permissions and path contains the name of an existing file; otherwise, false. If path is null or a zero-length string, returns false. [Edit]

Permissions

TypeReason
System.Security.Permissions.FileIOPermission [Edit] Requires permission to read the specified file. See System.Security.Permissions.FileIOPermissionAccess.Read.

Remarks

If the caller does not have sufficient permissions to read the specified file, no exception is thrown and the method returns false regardless of the existence of path.

The path argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory.

Note: To obtain the current working directory, see Directory.GetCurrentDirectory.

[Edit]

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0