JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the File Class

The File class lets you work with files, copying, deleting, and creating them. Here is the hierarchy for this class:

Object
   File

You can find the public class (shared) methods of this class in Table 13.20.

Table 13.20: Noteworthy public class (shared) methods of the File class.

Method

Means

AppendText

Appends text to a file, or creates the file if it does not exist.

Copy

Copies a file to a new file.

Create

Creates a file.

CreateText

Creates a StreamWriter object that writes a new text file.

Delete

Deletes a file.

Exists

Determines if a file exists.

GetAttributes

Gets the file attributes of a file.

GetCreationTime

Gets a file's date and time.

GetLastAccessTime

Gets the date and time a file was last accessed.

GetLastWriteTime

Gets the date and time a file was last written.

Move

Moves a file to a new location.

Open

Opens a FileStream object for the file.

OpenRead

Creates a read-only file.

OpenText

Creates a StreamReader object that reads from a text file.

OpenWrite

Creates a read/write stream for a file.

SetAttributes

Sets file attributes for a file.

SetCreationTime

Sets a file's date and time.

SetLastAccessTime

Sets a file's last access date and time.

SetLastWriteTime

Sets a file's last written date and time.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor