C# programming articles

C# logo

This page lists all tutorials for the C# programming language. The chapter articles below have an in-depth discussion, while the recipes focus on practical Q&A-like situations.

C# chapters

Part I: C# fundamentals

In this first part we discuss the fundamentals of programming in C#, and look at things like terminology and syntax, types and creating variables, and if statements and looping.

If statements

icon In this chapter we discuss how if statements evaluate conditions to execute a block of code (or not), which allows our code to react to changes while the program runs.

C#'s if statements

If statements in depth

If statement tips

Alternative if statements

Better if/else options

Back to table of contents ↑

Part 2: Work with C#

Files and directories

icon In this chapter we look at different ways to work with files and directories in C#, including watching folders and querying computer drives.

Drive information

Back to table of contents ↑

Essentials of C#

.NET Framework essentials

icon In this chapter we look at the essentials of working with the different components of the .NET Framework, like file operations and HTTP requests.

Files & directories

Back to table of contents ↑

Beyond C#

Visual Studio

icon In this chapter we explore Visual Studio features for coding and fixing C# applications.


Debug examples

Back to table of contents ↑

C# recipes

The C# recipes have helpful and practical code that’s ready to use in your project. Their Q&A format describes a specific situation and then jumps to a verified solution, followed by a discussion for a deeper understanding.


The recipes in this part discuss the fundamentals of programming in C#, like working with variables, operators, and branching statements.

Types and variables

icon In these recipes we explore the different type of values C# has, and how to create variables of them.

Back to table of contents ↑


icon In the recipes below we look at how C#’s operators work and how to efficiently code with them.

Back to table of contents ↑

If/else statements

icon This category of recipes is dedicated to if branching statements, like the regular if statement and more cryptic alternatives.

Type of if statements

Alternative if statements

Back to table of contents ↑

Work with C#

Computer drives

icon In the recipes of this category we look at the different ways in which we can fetch and operate on computer drives in C#.


Operate on computer drives

Back to table of contents ↑

Recipes hope to demystify a range of Hugo questions by breaking them down in small steps. Over time they create a library of possible Hugo questions. But they aren't intended as a definite reference: they simply show one particular approach. There are nearly always multiple and perhaps better (depending on your frame of reference and goal) ways to tackle a particular situation.


Recent C# content

icon The list below shows the most recent C# content, both new pages and the ones that got updated.

Recent C# articles

Recent C# recipes

Back to table of contents ↑

icon The most popular C# articles of the last 90 days are:

  1. Calculate free disk space in C#
  2. Replace C#'s if/else statements
  3. Set C# variables conditionally
  4. Computer drive info in C# | DriveInfo
  5. Computer drive root directory in C#
  6. C#'s nested if statement
  7. If/else and clear C# code
  8. Shorthand if/else statements in C#
  9. If/else: C#'s conditional operator
  10. Cascaded if statements in C#
  11. C#'s if statements + multiple true/false
  12. Filter computer drives in C# | DriveInfo
  13. Inaccessible computer drives in C#
  14. Start & stop debugging in Visual Studio
  15. Nested if/else statements in C#

Back to table of contents ↑