Get Started with C# in the Cards

C-Sharp, abbreviated as C#, is a statically-typed, compiled, object-oriented language used with the .NET frameworks and runtimes. The official Microsoft C# language reference can be found on

Similar to Java in syntax and structure, C# programs are compiled and executed against a .NET runtime running on a computer. The output of compiling C# code can be called a '.NET program'.

Importantly, the C# language is just one piece of building a computer program. If you want to use your new found C# knowledge to build a game, a website, a mobile application, or a native application to run on Windows, Mac, or Linux you will need to learn additional frameworks and libraries that will help you use the resources of those application types properly. While we can use the C# language to write a game and to build a website, the way you interact with a web server or an player's computer is significantly different even though the same programming language is used.

Note: This series is built with .NET 8 and C# 12 as the current versions in early 2024.

Get C# to run locally

You can get all of the tools to build with C# locally on your Mac or PC by installing Visual Studio or Visual Studio Code with the C# extensions. You can also install just the build tools for Windows, Mac, or Linux by following the instructions at We will be start by writing code using Jupyter Notebooks and .NET Interactive.

A .NET Runtime is a collection of commands native to the computer operating system that instruct the computer how to interpret and run a .NET program.

There are several different .NET runtimes available that give C# flexibility to run in many different locations.

  • .NET Framework - runs on Windows and support desktop user-interface, console, and server development
  • .NET (was .NET Core) - runs on Windows, Mac, and Linux with support for desktop user-interface, console, and server development
  • Xamarin - runs on iOS and Android devices with support for native application development on those devices
  • Unity - runs on Windows, Mac, Linux, iOS, and Android devices with support for game development using the Unity3D tools
  • Mono - runs on Windows, Mac, Linux, and Web Assembly, well-known as the basis for the Unity framework

A .NET Framework is a collection of programming instructions and tools that help you write a program of a specific type. Examples of .NET Frameworks include Windows Forms, ASP.NET, Xamarin iOS, and Blazor

C# requires a .NET runtime and frameworks for the appropriate program type to run. The definition of the framework and runtime for a C# program are stored in a .csproj file. We'll learn more about this file and structure in a future lesson.For now, know that the .NET tools will help construct and manage this file for you when you specify what type of program you want to create.

All C# files carry a .cs file extension by default.

Basics of Syntax

Here are the basic rules of C# code syntax that you should know as we get started.

C# uses a semi-colon to denote the end of a statement

This is a hard and fast rule, and you'll get used to it quickly. Every statement in C# needs to end with a semi-colon ;This allows us to also have very flexible spacing in how we structure our code.

C# is NOT space sensitive

You can place as many spaces, tabs, or blank lines around your code as you would like.

C# IS case sensitive

C# is case-sensitive.All variables, objects, and their interactions must be referenced with the proper casing.

Code Blocks are wrapped in curly braces

Blocks of code like classes, if statements, and loops are enclosed in curly braces to denote their executable content.

Comment Syntax

You can write comments by using the two forward-slash characters to indicate everything after them is a comment.

// This is a comment

You can create comments that span multiple lines by using slash asterisk fencing like the following:


This is a multi-line comment

and this is still commented out

About Us

CSharp In the Cards is a free technical educational series produced by Jeffrey T. Fritz and available in video, text, and source code formats. In the future, we plan to have more formats available

Contact Us

An unhandled error has occurred. Reload 🗙