C# Programming
C# is a statically-typed, object-oriented programming language developed by Microsoft for the .NET platform. It supports modern features like async/await, pattern matching, generics, and LINQ, used for building web applications, desktop software, games, and cloud services.
itProgramming languages | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic: C# Programming
C# is the language in which you describe data, decisions, and behavior for a .NET program. It is not the whole .NET ecosystem, which is fortunate because that would make one word responsible for a runtime, libraries, project tools, and several application frameworks. Keep the layers separate: C# source goes through a compiler, then a .NET runtime executes the managed program.
The useful bit is the type. A type says what a value can be and what operations make sense. A value-type variable holds its value. A reference-type variable holds a reference to an object, so copying it can leave two variables pointing at the same object. This is not a trap, provided you remember that an assignment copies what the variable contains, not necessarily a new object.
Types also let a program state its own boundaries. A class can protect state behind public operations. An interface names a capability without choosing one implementation. A record suits data with value-based equality. The compiler checks these declared contracts before the runtime turns them into behavior. It does not certify that the program wanted the right behavior in the first place, because compilers remain impressively unwilling to attend planning meetings.
Collections handle groups of values, and LINQ supplies a vocabulary for filtering, projecting, ordering, and grouping them. Many LINQ queries wait until enumeration to do their work. That is useful when a result should follow a changing source, and awkward when you thought you had captured a snapshot. ToList is the polite way to state that the result is needed now.
The other surprise is nullability. string? tells the compiler that null is allowed; string expresses the opposite intent in a nullable-aware project. The annotation guides analysis, not the runtime. A null-forgiving operator can silence a warning, but it cannot supply the missing object.
For work that completes later, a Task represents the eventual result and await yields control until it completes. That supports responsive interfaces and services during input-output work. It is not a promise of parallel CPU execution, because terminology has enough hobbies already.
Read the intro for the complete map of types, contracts, exceptions, LINQ, and async behavior. Use the slides when the relationships need to be visible at once. Keep the cheatsheet nearby while writing code, then use the practice session to make compiler diagnostics and nullable contracts concrete.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://dotnet.microsoft.com/languages/csharp
Supports
- C# is a general-purpose language in the .NET ecosystem
- C# is used across web, cloud, desktop, mobile, game, device, and related application workloads
- Microsoft provides C# compilers, tools, and learning resources as part of .NET
- https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/
Supports
- The C# tour introduces program structure, types, object-oriented features, and common language constructs
- The official learning path moves from beginner tutorials through the language tour and fundamentals
- C# supports multiple application workloads through the .NET ecosystem
- https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/types
Supports
- C# types are divided into value types and reference types
- Value-type variables contain their data while reference-type variables contain references to objects
- Assignment copies the value held by a variable, including a reference value
- Types determine permitted values and operations
- https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/types/built-in-types
Supports
- C# supplies built-in numeric, Boolean, character, and text types
- Local type inference with var produces a statically typed local variable
- Built-in C# type keywords correspond to .NET types
- https://learn.microsoft.com/dotnet/csharp/fundamentals/object-oriented/
Supports
- Classes, structs, and records are distinct type declarations
- A type definition specifies data and behavior available through that type
- Records support value-based equality for data-centered models
- Structs are value types and classes are reference types
- https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/tutorials/oop
Supports
- C# supports abstraction, encapsulation, inheritance, and polymorphism
- Encapsulation hides internal state and exposes behavior through a public contract
- Polymorphism permits different implementations through shared abstractions
- https://learn.microsoft.com/en-us/dotnet/csharp/linq/
Supports
- LINQ integrates query capabilities into C#
- LINQ supports filtering, ordering, grouping, projection, and transformation
- Query syntax compiles to standard query operator calls
- Many queries execute when the result is enumerated
- IEnumerable queries use delegates while IQueryable providers can inspect expression trees
- https://learn.microsoft.com/en-us/dotnet/csharp/linq/standard-query-operators/
Supports
- Sequence-returning standard query operators commonly use deferred execution
- Singleton operators such as Sum and Average execute immediately
- Standard operators include filtering, projection, aggregation, sorting, grouping, and joining
- IQueryable providers may translate expression trees to a native query language
- https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types
Supports
- Nullable reference annotations express whether null is intended
- Compiler null-state analysis produces warnings about possible null assignments and dereferences
- Nullable reference annotations do not create different runtime types or runtime checks
- The null-forgiving operator changes compiler analysis without validating the runtime value
- https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/
Supports
- Task and Task of T represent asynchronous operations
- Async and await support task-based asynchronous programming
- Awaiting enables code to yield control until an operation completes
- Asynchronous input and output can avoid blocking responsive interfaces and service threads
- https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/async-scenarios
Supports
- Input-output-bound work and CPU-bound work require different asynchronous approaches
- Await yields control and resumes the method after task completion
- The compiler transforms asynchronous methods into state machines
- Asynchrony does not by itself guarantee parallel execution
- https://ecma-international.org/publications-and-standards/standards/ecma-334/
Supports
- ECMA-334 specifies C# program representation, syntax constraints, semantic rules, and conformance limits
- The seventh edition of ECMA-334 was published in December 2023
- C# is a general-purpose, object-oriented programming language
- A conforming C# implementation need not rely on Microsoft's .NET runtime if it provides the required execution support another way
- https://learn.microsoft.com/en-us/dotnet/core/tutorials/create-console-app
Supports
- The .NET SDK can create and run a C# console application
- A console application project contains C# source that the SDK runs
- https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-new
Supports
- dotnet new console creates a C# console application project
- https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history
Supports
- C# release history documents major language versions and their features
- C# 2.0 introduced generics and nullable value types
- C# 3.0 introduced LINQ-related language features
- C# 4.0 introduced dynamic binding
- C# 5.0 introduced async and await
- C# 7.0 expanded tuple and pattern-matching features
- C# 8.0 introduced nullable reference types
- C# 9.0 introduced records and top-level statements
- C# 12 introduced primary constructors and collection expressions
- https://devblogs.microsoft.com/dotnet/should-i-expose-synchronous-wrappers-for-asynchronous-methods/
Supports
- Blocking on an asynchronous operation can deadlock a UI synchronization context
- Synchronous wrappers over asynchronous operations need careful context handling
- https://devblogs.microsoft.com/dotnet/asyncawait-faq/
Supports
- Async methods normally return Task or Task of T
- Async void has distinct exception and composition behavior
- https://devblogs.microsoft.com/dotnet/performance_improvements_in-net-7/
Supports
- .NET performance work has improved common LINQ implementation paths
- LINQ performance should be assessed in the context of actual code paths
- https://visualstudio.microsoft.com/
Supports
- Visual Studio provides .NET and C# development tooling
- https://www.jetbrains.com/rider/
Supports
- Rider provides development tooling for .NET and C#
- https://code.visualstudio.com/
Supports
- Visual Studio Code is an editor that supports C# development through extensions
- https://unity.com/
Supports
- Unity supports C# scripting in game development
- https://godotengine.org/
Supports
- Godot supports C# as a programming language option
