Working with files and folders, Abstract base class...

Working with files and folders

When developing real applications, it is mandatory to store data on external memory devices to support communication between sessions of the application. In the .NET platform library - FCL - there is a System namespace. 10 containing a set of classes for working with folders (directories, directories) and files on external devices. This namespace includes the Directory and File classes that contain methods for creating, deleting, copying, and moving folders and files using static methods. With these classes, the Filelnfo and Directorylnfo classes are closely related, which contain similar functionality, but they use the methods of the instances of the class (so the objects of these classes must be created using the new operation to work with them). Classes Filelnfo and Directorylnfo are derived from the abstract class FileSystemlnfo. Classes Filelnfo and Directorylnfo are best used to get all the detailed descriptions of files and folders (for example, the time of their creation, the possibility of reading/writing, etc.), because the methods of these classes return strongly typed objects. And the methods of the Directory and File classes more often return simple string values, rather than strongly typed objects.

Abstract base class FileSystemlnfo

Classes Directorylnfo and Filelnfo receive many methods from the abstract class FileSystemlnfo. The elements of the FileSystemlnfo class are mainly used to obtain common characteristics (such as creation time, various attributes, etc.) about a particular file or folder.

The FileSystemlnfo class also defines the Delete () method, which is implemented in derived classes to delete a specified folder or file from an external device. And also the Refresh () method is defined, calling which before obtaining information about the attributes guarantees that this information is not obsolete.

Table 9.1

Properties of the FileSystemlnfo class




getting or setting attributes associated with the current file or the nank, which are represented as FileAttributes enumeration


getting or setting the time to create the current file or folder


can be used to determine whether a given file or folder exists


getting the file extension


getting the full path of a folder or file


getting or setting the time when the current nanda or file was last used


getting or setting the time when the current nanku or file was last recorded


getting the name of the current folder or file

Also We Can Offer!

Other services that we offer

If you don’t see the necessary subject, paper type, or topic in our list of available services and examples, don’t worry! We have a number of other academic disciplines to suit the needs of anyone who visits this website looking for help.

How to ...

We made your life easier with putting together a big number of articles and guidelines on how to plan and write different types of assignments (Essay, Research Paper, Dissertation etc)