C# Story

C# Story Prologue

starting, story content, references

0.0 Prologue

The C# programming language is a modern, elegant, and widely used programming language developed by Microsoft. It runs on the .NET platform and is a primary language for building Windows applications, web services, cloud applications, and games.
Why C# ?
  1. C# runs on the .NET Common Language Runtime (CLR), which provides automatic memory management through garbage collection, making resource handling safer and simpler than in languages like C++.
  2. C# is a strongly typed language with extensive compile-time checking, reducing classes of bugs while keeping developer productivity high.
  3. The language has a rich, well-designed standard library (the .NET Base Class Library) that provides solutions for most common programming tasks out of the box.
  4. C# supports multiple paradigms: object-oriented, functional (LINQ, delegates, lambdas), and component-oriented programming.
  5. With .NET 5 and later, C# applications run cross-platform on Windows, Linux, and macOS using the same codebase.
  6. The language continues to evolve rapidly, adding features like records, pattern matching, nullable reference types, async/await, and Span<T> that make code safer and more expressive.
This story is intended to help you get started or refresh your knowledge of C#.

0.1 Getting Started

To get started, you need: basic knowledge of the language, a tool chain to build programs, and the will to start building with much less than perfect knowledge.
  1. Basic C# Knowledge:
    This story provides a lot of what you need, along with links to the existing C# Bites pages and the references at the end of this page.
  2. C# Tool Chain:
    Download the .NET SDK (version 8.0 or later recommended). On Windows you may also want Visual Studio Community Edition which provides an excellent IDE for C# development. On any platform, Visual Studio Code with the C# extension works well.
  3. Now start:
    Create a new console project with dotnet new console -n Hello, open the folder, and start exploring.

0.2 Story Content

This is a story about the C# programming language. It orders content from this site into a sequence of chapters about C# syntax, semantics, and idioms. Each chapter is a single web page accessible from the Pages list at the lower right. Chapters:
  1. Prologue

    Motivation for, and layout of, C# story.
  2. C# Models

    Key concepts: CLR, compilation, memory management, value vs reference types, generics.
  3. Survey

    A quick tour of the major C# language features.
  4. Data

    C# types, value semantics, reference semantics, initialization, and nullable types.
  5. Operations

    Methods, delegates, lambdas, LINQ, and extension methods.
  6. Classes

    Class anatomy, properties, constructors, records, and interfaces.
  7. Class Relationships

    Inheritance, interfaces, abstract classes, composition, and polymorphism.
  8. Generics

    Generic types and methods, constraints, variance, and comparison with C++ templates.
  9. Reflection

    System.Reflection: runtime type inspection, dynamic invocation, attributes, emit.
  10. Libraries

    Overview of the .NET Base Class Library and commonly used packages.
  11. Collections Library

    System.Collections.Generic: List, Dictionary, HashSet, and LINQ.
  12. Streams Library

    System.IO: file streams, memory streams, readers and writers.
  13. FileSystem Library

    System.IO: FileInfo, DirectoryInfo, directory enumeration, FileSystemWatcher, DriveInfo.
  14. Threads Library

    System.Threading: Thread, Task, lock, Mutex, SemaphoreSlim, CancellationToken, Interlocked, concurrent collections.
  15. Network Library

    System.Net: HttpClient, TcpClient, TcpListener, UdpClient, Socket, WebSocket, IPAddress, IPEndPoint, Dns.
  16. Interesting

    Async/await, Span<T>, attributes, unsafe code, source generators, and pattern matching.
  17. New Things

    Significant additions in C# 11, 12, and 13: raw strings, required members, list patterns, generic math, primary constructors, collection expressions, params collections, and more.

0.3 References

Reference Description
Microsoft C# docs Official C# language reference and tutorials.
w3schools.com Quick tutorial with examples.
tutorialspoint.com Fairly quick with examples.
Tour of C# Microsoft's introductory tour of all major C# features.
dotnetfiddle.net Browser-based C# REPL — run snippets without installing anything.
BCL API reference Complete .NET Base Class Library API documentation.