Eric Sjöström Jennerstrand

Litium E-commerce, C#, .NET MAUI, Javascript, React, Azure, Git. .NET, Node and more!
Create directory in C#

How to create a directory in C#

To create a directory in C#, all you need is one line. Because the method CreateDirectory will create directories or folders, all the way down the tree. So this means that you don’t need to make any if statments to check if the directory exists. The method CreateDirectory will do that for you.

Create directory in C#
Create directory in C#

Using the method CreateDirectory is the best and fastest way to create folders/directories in C# and is widely used in my projects.

Check this post if you need to create a file in C#:
Or look at this post to write lines to a text file:

Source on directory/folders from Microsoft:

Check out these simple easy to read articles about add object to List, reverse for loops and for loops if you want som extra reading:

Leave a Reply

Your email address will not be published. Required fields are marked *.

You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>