C# Logo - C# Beginners Series

C# Beginners Series Introduction; is aimed at first-time users of C#. The series assumes no prior knowledge of programming or C#. So why start coding in C#? C# forces coders to recognise and state data types from the outset. Data types fundamentally underpin all programming languages, so this is something essential to learn.

The syntax in C# is similar enough to most C-based languages that moving between them becomes more accessible than moving from a language such as Python. C# is now a cross-platform language, meaning it can run on Windows, Linux and Mac machines and on many mobile platforms.

There are many more reasons to choose C#, but understanding how programming languages work is essential to understand the benefits. For the sake of clarity, here are a few:

  • Statically typed by default (dynamic types supported).
  • Strongly typed.
  • Interpreted and Compiled, choose what suits you.
  • Cross Platform.
  • Pass by reference and pass by value.
  • Full Object Orientated Programming Implmented
  • C# is quick; there are quicker languages, but few that offer the same flexibility.

A first look at C# Code - "Hello World!" - C# Beginners Series

"Hello World!" is the classic "first look" at a program. The program outputs the words "Hello World!" to the console screen. I am going to show two versions of this program. The first is the classic view of the "Hello World" program in C#. Then the second is the default view in .Net6, which is the latest long-term support version of C#.

The differences are aesthetic rather than structural. However, when looking at online examples, you will likely see both versions. So I wanted to make it clear straight away that there is a difference. It is possible to switch back to the original style but more on that later.

Hello World - Classic View

namespace C_SharpFrameworkDemo
    internal class Program
        public static void Main(string[] args)
            Console.WriteLine("Hello, World!");

Hello World - Dot Net 6 Default

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

Running C# Code In a Browser - C# Beginners Series

It is possible to run C# in a browser. However, it is not a way I am going to recommend. When learning C#, learning to understand the file and folder structure is essential. Usually, C# files are not run as a standalone file but are part of a solution. Despite this, there are online options available. One such offering is from Replit

Replit.Com - C# View

Running C# On Your Computer

The best way to install C# on your computer is totally platform dependant. Microsoft Windows users should usually install it as part of Microsoft Visual Studio. Linux and Mac users must install the Dot Net SDK and a different IDE, such as JetBrains Rider or Microsoft Visual Studio Code.

Install C# On Windows

Install C# Linux (Ubuntu)

sudo apt-get update && \ sudo apt-get install dotnet-sdk-6.0

Install C# on Mac

Microsoft Guide - Sorry, I do not own a Mac to make this.