← Back to Tutorials Chapter 1

Getting Started with C#

What is C#?

C# (pronounced "C Sharp") is a modern, object-oriented programming language developed by Microsoft. It runs on the .NET platform and is used for building desktop apps, web apps, games (Unity), mobile apps, and cloud services.

Key Idea: C# is a statically-typed language — variables must have a declared type checked at compile time.

Your First C# Program

using System;
namespace MyApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");
        }
    }
}

Basic Syntax

Console Output

Console.WriteLine("With new line");
Console.Write("Without new line");
Console.WriteLine($"Interpolated: {value}");

Comments

// Single-line
/* Multi-line */
/// XML documentation
C# program structure

Practice Task

Write a C# program that applies the concepts covered in this chapter. Experiment with different inputs and test your understanding.