In this video, Jesse Freeman walks through the core classes that make up the .NET file system API inside of the System.IO namespace. This course covers the three primary file system classes which are the Directory, File and Path. Once you master these >NET classes you will be able to read and write to a user's file system.
- [Instructor] During this course, we're going to primarily work with a System.IO Namespace. This namespace, that's part of the .net framework, contains all of the classes we need to work with the file system. If you'd like to learn more about this namespace, and the classes that are contained within it, please take a look at Microsoft's documentation. As you can see, there are lots of classes that make up this namespace. We're going to simply focus on three of the main classes during this course.
The first class is our Directory Class. We'll be using static methods on this class in order to create directories, as well as copy, move, and delete them. This class represents the main way to work with any folder on the file system. Next, we'll take a look at the File Class. The File Class allows us to manipulate files inside of folders. We'll be able to read and write to files, as well as copy, delete, and move them through the static methods on this class.
This class is incredibly important when it comes to reading data and saving it back into a file, using a FileStream object. And finally, we're going to talk about the Path Class. The Path Class allows us to get information based on a certain path in the file system. This class is incredibly important when we just need to get the file name from a path or its extension, without having to parse the string. These three classes represent the foundation of working with the file system.
Whether you're building a command line tool, an application, or a game, these classes work consistently across any application that leverages the .net framework.
- Creating a simple command line app
- Creating a new folder
- Creating multiple folders
- Deleting and copying folders
- Cleaning up folder logic
- Creating a config file
- Copying, editing, and moving a config file
- Saving images
- Organizing file access logic
- Protecting the file system