Document management File Class
In the previous lecture, we learned about several types of generic collections, and today we mainly study the basic use of file.
First, the file class is a static class and cannot be instantiated. Its namespace is: using System.IO
The basic method in file is shown below:
Figure I, File.create
Figure II, File.Copy general situation
Figure III, File.Copy (PATH,PATH1,TRUE);
Figure IV, File.delete
Figure V, file.exists ();
Figure VI, File.move
Figure VII, File.ReadAllLines ()
Figure VIII, the difference between ReadAllText and ReadAllLines
Fig. Nine or one simple exercises
Figure X, File.replace
Figure 11, File.writealllines ()
Figure 12, File.writealltext ()
Figure 13, File.appendalllines ()
Figure 14, File.appendalltext ()
Above, we summarize the methods in the file files. What I want to say is that in practice it is the project. These basic methods will help us. The so-called, do not accumulate kuibu, not even thousands of miles. Flexible use, one is more practice, another need to pay attention to the need for more summary.
Here's how to create a folder and more.
Figure 15, Directory.CreateDirectory
Figure 16, Directory.Exists
Figure 17, Directory.getcreationtime
Figure 18, Directory.GetCurrentDirectory
Figure 19, Directory.GetFiles ()
Figure 20, Directory.move
Document management File Class