File
The File class can be used to manipulate files. It provides a set of static methods for common operations such as creating, copying, moving, renaming, and deleting files.
静态方法
File.Exists ( path : string ) : boolean |
| Check if the specified file exists. |
File.GetParent ( path : string ) : string |
| Get the name of the parent folder for the specified path. |
File.Create ( path : string ) : void |
| Create a file at the specified path. |
File.ReadAllText ( path : string ) : string |
| Reads and returns all characters in the file at the specified path. |
File.Delete ( path : string ) : void |
| Deletes the file at the specified path. |
File.Move ( src : string , dst : string ) : void |
| Move the source file to the specified path. |
File.Copy ( src : string , dst : string ) : void |
| Copy the source file to the specified directory. |
File.ReadAllBytes ( path : string ) : MemoryStream|undefined |
| Reads and returns all data from the file at the specified path into a memory stream. |
File.WriteAllBytes ( path : string , data : MemoryStream ) : boolean |
| Write the content of a memory stream to a file at the specified path (overwrite the original content). |
File.WriteAllText ( path : string , content : string ) : void |
| Write the text content to the specified file path (overwrite the original content). |
