What is StringBuilder in C# and How to Use it

StringBuilder in C# with Examples This tutorial describes what StringBuilder is in C# and how to use it. A StringBuilder is a class that presents a mutable string of characters. More C# tutorials: How to write to file in C# How to read text from a file in C# StringBuilder Initialization You can initialize a … Read more

C# Read Text File with StreamReader

How to Read Text from A File with StreamReader This tutorial describes how to read text from a file with StreamReader in C#. StreamReader provides various methods to read text from a file. Related tutorial: How to write to a file in C# with StreamWriter ReadToEnd Method You can write a program to read text from a … Read more

C# Write to File with the File Class and StreamWriter

How to Write Strings and Text to File in C# This tutorial describes how to write strings and text to a file with the File class and StreamWriter in C#. Related tutorial: How to read text from a file with StreamReader 1. Writing text to a file with the File class WriteAllText Method To write text to a … Read more

C# switch case Statements with Examples

How to Use switch case Statements in C# This tutorial describes how to use switch case statements in C#.  The switch statement chooses one of the blocks of code, which matches the switch expression to execute. We often use the switch-case statements when we test a single expression against three or more conditions. You can use if-else if there are only a few … Read more

C# if-else Statements with Examples

How to Use the if-else Statements in C# This tutorial describes how to use the if-else statement in C# programming language. An if statement decides which block of code to execute based on a specified condition. If the specified condition evaluates to true, then code inside the if statement block runs. If the specified condition is false, code inside the else statement block … Read more

C# while Loop Statement with Examples

How to use a while Loop Statement in C# This tutorial describes how to use a while loop statement in C#. A while loop is a control flow statement to execute a block of code while a specified condition evaluates to true. A while loop can execute zero or more times.  If you need to break out the loop, … Read more

C# for Loop Statement with Examples

How to Use the for Loop Statement in C# This tutorial describes how to use the C# for loop statement.A for loop is a control flow statement that you allow you to execute a block of code repeatedly. Related C# tutorials: C# foreach loop statement C# while loop statement The for Loop Syntax The syntax … Read more

C# foreach Statement with Examples

How to Use the foreach Statement in C# This tutorial describes how to use the foreach statement with examples in C#. The foreach statement executes a block of code for each element of a given collection, such as a list, dictionary, or array. Related C# tutorials: A for loop statement in C# A while loop … Read more