C # FileInfo Class

Source: Internet
Author: User

Unlike the file class, the FileInfo class does not have a static method and can be used only for instantiated pairs of images. FileInfo to files that are represented on a disk or network location, note that it is not a stream, and in order to read and write files, you must create a stream pair image.

The FileInfo class provides the following properties about the underlying file that may be used to update the file.

Attributes-----Gets or sets the properties of the current file

CreationTime------Gets the date and time the current file was created

directoryname------Get the path to the file directory

Exists------Determine if a file exists

FullName------Retrieving the full path of a file

Length------Get the file's capacity

Name------simply returns the name of the file, not the full file location path,

When in. NET code, you can use either an absolute pathname or a relative path name. An absolute pathname explicitly specifies where the file or directory comes from-a known location-such as a C: drive. Its-an example is C:\work\LogFile. Txt. Note that it clearly defines its position.

Relative pathname to the location where the application is running on the file system. By using a relative path name, there is no need to specify a known drive or location; The current directory is the starting point. For example, if the application is running on the C:\DeVelopment\FileDemo directory (where the application refers to the code-generated EXE file) and uses the relative path "LogFile". TXT, "then the file is located in C:\DeVelopment\FileDemo\LogFile.txt. In order to move the directory up, use the: Character. In this way, in the same application path ". /test.txt "is a file test.txt that points to the top-level directory in the directory where the application resides.

C # FileInfo Class

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.