20.6. Working with the FileInfo Class

As shown in the previous DirectoryApp example, the FileInfo class allows you to obtain details regarding existing files on your hard drive (e.g., time created, size, and file attributes) and aids in the creation, copying, moving, and destruction of files. In addition to the set of functionality inherited by FileSystemInfo, you can find some core members unique to the FileInfo class, which you can see described in Table 20-4.

Table 20.4. FileInfo Core Members
MemberMeaning in Life
AppendText()Creates a StreamWriter object (described later) that appends text to a file.
CopyTo()Copies an existing file to a new file.
Create()Creates a new file and returns a FileStream object (described later) to interact with the ...

Get Pro C# 2010 and the .NET 4 Platform, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.