From the course: C# and .NET Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Creating files

Creating files

- Even in our current modern era of programming with all kinds of web services and REST APIs, many applications still need to work with files. In this chapter we're going to learn about some of the basic dot net features for working with files. Creating them, reading and writing data. Getting information about files and working with directories. Let's get started with creating a file and to keep things simple, I'm going to focus on working with text files. So let's open up our program code, here in the Start File for CreateFiles. So to create a text-based file, we use appropriately enough the Create text method on the file class. And I'm going to do this with the C sharp using construct like this. I'm going to write Using. (keyboard tapping) And then I'm going to declare a Streamwriter object. That's going to get the result of a call (keyboard tapping) to the file dot. (keyboard tapping) Command visual studio,…

Contents