NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

File.FileExists

Determines whether a file exists on the specified path.

[Visual Basic]
Public Shared Function FileExists( _
   ByVal path As String _
) As Boolean
[C#]
public static bool FileExists(
   string path
);
[C++]
public: static bool FileExists(
   String* path
);
[JScript]
public static function FileExists(
   path : String
) : Boolean;

Parameters

path
The path to search for the file.

Return Value

true if the file given by the specified path exists, false if the file does not exist or if path specifies a directory.

Exceptions

Exception Type Condition
ArgumentException path is the empty string ("") or contains only whitespaces.
ArgumentNullException path is null.
IOException path is invalid or an I/O error occurs (for example, a disk error).
SecurityException The caller does not have the required permission.

Remarks

path can be either relative or absolute. A relative file path will be fully qualified based upon the current directory and drive.

If path describes a directory, this method returns false.

Requirements

NGWS Runtime Security:

FileIOPermissionAccess Read permission for the target directory.

See Also

File Class | File Members | System.IO Namespace