From the course: C# File System Tips and Tricks

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Resusability

Resusability - C# Tutorial

From the course: C# File System Tips and Tricks

Start my 1-month free trial

Resusability

- [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…

Contents