C# Tutorial 17 File I/O


Get the Code Here :
Best C# Book :
Support me on Patreon :

This part of my C# tutorial is based completely on File I/O. We’ll learn how to Mess with Directories, Use File to Read and Write to Files, Get File Info, Use FileStream, Use StreamWriter, Use BinaryWriter & BinaryReader, and much more.

For best results take notes on the cheat sheet provided above as you watch and leave any questions you have.

Thank you to Patreon supporters like the following for helping me make this video

jaryd remillard : instagram: @distant_admiration
jaryd remillard :



  1. Is it possible to create and write to a text document as a different user? I'm building a digital forensic challenge creation toolkit using C# and powershell. I require the use of administration access to manipulate the flow of time within the toolkit however I would be interested if it were possible to write files as a standard user using the system.io library. I can achieve this using powershell however, the Lochard Principal really puts pressure on my design to limit any potential fingerprint where possible.

  2. Thanks for the tutorial this is what I was looking for. But how can I read write and create files which are saved in individual paths? Example – someone installs the program to the disc D but in code is given dir to desktop on the disc C. Does IO system offers path reading?
    I know there is smth like Environment.MachineName and so on, but in this case you have to define a lot of strings to get the whole path.

  3. Hello! I need some help. So I am new to C# and currently working on a small project of mine. How do I make a program so when you run it, it will ask you about for example "how many subfolders do you want to create" and you type in the amount of folders that you wish to create and the program will do it. I have been stuck on this problem for quite some time now and can't find any solutions. Does anyone in here know? Basically only folders, no text files or anything like that. Thanks.

  4. Derek I wish you would make these videos twice as long and really take more time in explaining everything slower. These videos seem so rushed. I really like the videos but I always need to rewind and pause. Also you seem to gloss overthings when really if you explained them in detail I think people would learn better from watching these videos.

  5. A question. What is the @ letter before the strings? I have been googling it for 10 minutes and can't find the answer…

  6. A question, when Reading data with filestreams, Why is it we need to create an additional bytearray to store the bytes from rsByteArray, Why not just get the rsByteArray and use the .GetString function on that?

  7. //Creating a directory

    DirectoryInfo newDirectory = new DirectoryInfo(@"C:Usersetcetc");
    newDirectory.Create(); //This method will create a directory
    newDirectory.Delete(); //This method will delete the directory

  8. First video I've watched but will definitely watch the others.

    By far the most informative and well laid out tutorial I've seen.
    Straight to the point and clearly shows how methods can be used.


Please enter your comment!
Please enter your name here