Module 1: C# & .NET Introduction

Introduction to .NET ecosystem, installation, and basic project setup.

Duration: 45 minutes

Learning Objectives

  • • Understand the difference between .NET Framework vs .NET Core/.NET 8
  • • Learn how C# compilation works (C# → IL → Machine Code)
  • • Set up Visual Studio Code with C# Dev Kit
  • • Create and run basic C# projects
  • • Understand basic project structure and commands

Prerequisites

• Windows 10 version 1909+ or Windows 11

• Minimum 8GB RAM (16GB recommended)

• At least 20GB free disk space

• Admin rights for installation

• Stable internet connection

Installation Steps

Step 1: Install .NET SDK (15 minutes)

  1. 1. Go to https://dotnet.microsoft.com/download
  2. 2. Download .NET 8.0 SDK (latest LTS)
  3. 3. Run installer with default settings
  4. 4. Verify installation with: dotnet --version

Step 2: Install Visual Studio Code (10 minutes)

  1. 1. Go to https://code.visualstudio.com/
  2. 2. Download for Windows
  3. 3. Run installer with recommended settings
  4. 4. Launch VS Code after installation

Step 3: Install C# Dev Kit Extension (5 minutes)

  1. 1. In VS Code, press Ctrl+Shift+X (Extensions)
  2. 2. Search for "C# Dev Kit"
  3. 3. Install the C# Dev Kit by Microsoft
  4. 4. Restart VS Code after installation

Key Concepts

.NET Framework vs .NET Core/.NET 8

Understanding the evolution and differences between .NET Framework (legacy) and .NET Core/.NET 8 (modern, cross-platform).

C# Compilation Process

C# source code → Intermediate Language (IL) → Machine Code. Understanding how .NET's Just-In-Time (JIT) compilation works.

Project Structure

Understanding .csproj files, Program.cs, namespaces, and basic project organization.

Demo Project

using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to C# Training!");
            
            Console.Write("What's your name? ");
            string name = Console.ReadLine();
            
            Console.WriteLine($"Hello, {name}!");
            Console.WriteLine($"Today is {DateTime.Now:dddd, MMMM dd, yyyy}");
            
            Console.WriteLine("\nPress any key to exit...");
            Console.ReadKey();
        }
    }
}

Essential Commands

dotnet new console - Create new console application

dotnet run - Run the application

dotnet build - Build the project

dotnet --version - Check .NET version

Troubleshooting

• If dotnet command not found, restart terminal

• If VS Code doesn't recognize C#, restart VS Code

• Check .NET installation with dotnet --list-sdks

• Ensure C# Dev Kit extension is properly installed