To read a text file in C#, you will use a StreamReader object. In this tutorial, you will learn how to use StreamReader to read the contents of an existing file. ... Read more
C# for Beginners
This tutorial series will help you learn the basics of C# programming.
You will start by learning common definitions. Next, you will code simple console applications. As the series progresses, you will learn more advanced techniques until you are able to use a variety of structures to code dynamic C# applications.
To asynchronously write to a text file in C#, you will use the StreamWriter constructor within an async method. StreamWriter can also be used to write strings to a file synchronously, or to append to an existing file. To use StreamWriter asynchronously, include the following
using
directives in your ... Read moreTo write to a text file in C#, you will use a StreamWriter object. In this tutorial, you will learn how to use StreamWriter to write a string to a file synchronously. You can also use StreamWriter to append text to an existing file and to write to a ... Read more
For a given class in C#, you may need different ways to pass arguments to it. You can do this by overloading a constructor. Overloaded constructors enable you to initialize objects of the same class in different ways - for example, by passing in different numbers of initial parameters. ... Read more
Suppose you want to get the number of days between two dates, or the number of seconds between two times. In C#, you can use the
DateTime.Subtract
method to compute the difference between dates and times. ... Read moreYou will make a menu-driven program in this tutorial. Using a
while
loop, you will learn how to add a menu to a C# console application. This technique helps your users navigate your app, and it enables you to create more robust C# programs. ... Read more