Resusability

Keyboard Shortcuts

In this video, Jesse Freeman walks you how to take all of the file system code and abstract it into a reusable set of API code that is more portable. Ideally, you can use this set of code to create a sharp ale File System API library to reuse in different .NET projects.

- [Instructor] Now that we're saving our folders…and files into a safe location,…let's talk a little bit about abstracting out…all the calls we're using on the file system.…Now, this is a pretty simple application,…so it's okay for us to directly call…the directory and file classes.…But in a much larger application,…especially one that may need to run…on different types of operating systems…or different platforms,…it makes sense to create a separate class…that can manage all the calls to the file system.…

It's also better to separate out this logic…so that we can add additional logic…to safe guard making any calls to the FileSystem.…We may want to create a folder by default…every time we request one,…but this isn't a feature of the directory class.…To get started let's scroll to the top of our class…and just comment out using System IO for now.…If we scroll down you'll see we now have errors…everywhere we have a reference to any of the classes…that belong to the System.IO namespace.…

The first thing we're going to do…

Resume Transcript Auto-Scroll

Author

Released

4/5/2017

You may often need to access the underlying file system within your C# application. In this course, discover how to work with .NET System.IO classes for accessing the file system. Instructor Jesse Freeman shows how to create, delete, and move folders using the Directory class, as well as how to create, read, copy, edit, and move config files. Plus, he explains how to protect your file system, and organize your file access logic by abstracting out your file system API calls into a single class.

Topics include:

State the type of variable that holds a list of multiple directories.

Explain how to convert the integer x to a FolderNames enum.

List how to refactor the code when you have student, courseb and course content information in one file.

Identify the best approach to know what functions to factor out that belong to System.IO namespace.