Introduction to C#

Welcome to the Coding in C# tutorial series. While working through these tutorials you will learn the fundamentals of object-oriented programming and develop the skills to write your own applications using the C# programming language.

C# is a modern, general purpose, object-oriented programming language used to develop desktop applications on both Windows and Mac platforms, mobile apps for iOS, Android and Windows Phone platforms, as well as games for desktop, mobile and even consoles. The aim of this series is not just to teach you the code, but to give you a solid understanding of the object-oriented programming paradigm (covered later in the series).

To get started, you’ll need a programming environment to code in. There are different programs you can use for writing C# code and testing your applications such as

In these tutorials, I will be demonstrating C# coding using Xamarin on MacOS although the steps will be mostly the same using other software on other platforms.

Watch the video below and then scroll down to see the sample code for your first Hello World application in C#.

Sample code

using System;

namespace MyCSharpProject
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            // This displays "Hello world" message:
            Console.WriteLine("Hello world!");
            // This stops console from auto-exiting:
            Console.ReadLine();
        }
    }
}

Next tutorial: Variables, constants and data types