C#

C# Fundamentals

19 lessons

Progress0%
1. Introduction to C#
1What is C#?
2. Variables and Data Types
1Data Types in C#
3. Control Flow
ConditionalsLoops
4. Methods
Defining MethodsOptional Parameters and Overloading
5. Object-Oriented Programming
Classes and PropertiesInheritanceInterfaces and Generics
6. LINQ and Async
LINQ Queriesasync/await
7. Exception Handling
try/catch/finally & Exception TypesCustom Exceptions & IDisposable
8. Delegates & Events
Delegates & LambdaEvents & Event Handlers
9. Records & Pattern Matching
Record TypesPattern Matching & Switch Expressions
10. File I/O & JSON
File & Stream OperationsJSON Serialization
All Tutorials
C#Introduction to C#
Lesson 1 of 19 min
Chapter 1 · Lesson 1

What is C#?

C# (pronounced "C-sharp") is a modern, object-oriented programming language developed by Microsoft. It was created by Anders Hejlsberg and released in 2000 as part of the .NET initiative.

Key Features:

  • Type Safe: Strong typing prevents many bugs
  • Modern Syntax: Clean, expressive, constantly evolving
  • Cross-Platform: .NET Core runs on Windows, Mac, Linux
  • Garbage Collected: Automatic memory management
  • Rich Ecosystem: Extensive standard library

Where C# is Used:

  • Game Development (Unity)
  • Web Applications (ASP.NET)
  • Desktop Apps (WPF, WinForms, MAUI)
  • Cloud Services (Azure)
  • Mobile Apps (Xamarin, MAUI)

C# Versions: C# evolves quickly. C# 12 is the latest, with features like primary constructors and collection expressions.

Code Examples

Hello Worldcsharp
// Modern C# (top-level statements)
Console.WriteLine("Hello, World!");

// Variables with type inference
var name = "C#";
var version = 12;

Console.WriteLine($"Welcome to {name} {version}!");

// Traditional class structure
public class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello from Main!");
        
        // String interpolation
        string language = "C#";
        int year = 2024;
        Console.WriteLine($"{language} in {year} is amazing!");
    }
}

Modern C# supports top-level statements for simple programs. The $ prefix enables string interpolation.

Quick Quiz

1. Who created C#?

Was this lesson helpful?

OverviewNext