This project contains the source code for the book Essential C# by Mark Michaelis (Addison-Wesley).
Clone or download


This project contains the source code for the book Essential C# by Mark Michaelis (Addison-Wesley).

Sample Code Guide

Ensure one of the following frameworks is installed at the latest version.

Visual Studio 2017 contains the .NET Framework runtime as well as gives options to install .NET Core. Not to mention, it's a great IDE that makes it easy to get started.

Download the Code

Local Copy

Open a console and change the working directory to the desired project location.

$ git clone --recursive
$ cd ./EssentialCSharp/

Note: --recursive is used to ensure that the submodules, specifically IntelliTect.TestTools (which includes a testing framework for .NET console applications).

The source code associated with the master is the most recently published edition of the book and this is the default branch following the clone command. However, you can switch to a different branch, v6.0 for example, with the command:

$ git checkout v6.0


EssentialCSharp.sln is the project's main solution, open this with Visual Studio and Build All.

For those using the command line, build all the projects from the /EssentialCSharp/ directory with these commands:

$ dotnet restore EssentialCSharp.sln
$ dotnet build EssentialCSharp.sln


Navigate to an individual project in the /EssentialCSharp/src/(project)/ directory and run the code. The example below is for Chapter01 with the user entering 1.1 to execute the listing number.

$ cd ./src/Chapter01/
$ dotnet run
Enter the listing number to execute (e.g. For Listing 18.1 enter "18.1"): 1.1


Hello. My name is Inigo Montoya.

End of Listing 01_01
Press any key to exit.

Documentation for .NET CLI tools can be found here:

Batch Testing

Use one of the following scripts to execute a batch test on all the projects.

  • /EssentialCSharp/RunTests.ps1 (Windows)
  • /EssentialCSharp/ (Linux/Mac)

If running on Linux you may need to give the script execution permission. From the /EssentialCSharp/ directory:

$ chmod +x ./
$ ./