Programming language
C#
C# is a statically typed, general-purpose language in the .NET ecosystem for building applications, services, tools, and libraries.
What is C# and what does it do?
C# is a general-purpose programming language built around static typing, automatic memory management, and the .NET platform. It can describe anything from a small command-line tool to a desktop interface or an HTTP service. The compiler checks the source, while the .NET runtime supplies services such as execution, memory management, and access to a broad standard library.
C# makes application rules visible. A type can state what data exists, a method can state what may happen to it, and an interface can define what another part of the program is allowed to depend on.
Types can carry a rule
A type that protects a small rule is stronger than a comment that asks every caller to remember it. Records, pattern matching, nullable reference analysis, and generics provide several ways to keep those rules close to the values they govern.
public sealed record Invoice(decimal Net)
{
public decimal Total(decimal taxRate)
{
if (taxRate < 0) throw new ArgumentOutOfRangeException();
return Net + (Net * taxRate);
}
}
The example is deliberately small. The decimal type makes the numeric choice explicit, and the guard still handles a rule that static typing cannot prove.
From source to a running application
A common execution path has four useful stages:
- The compiler checks C# syntax and type relationships.
- A build commonly produces an assembly containing managed code and metadata.
- The Common Language Runtime loads and executes that assembly.
- The application uses .NET libraries and operating-system resources through that runtime.
This separation distinguishes compile-time checks from runtime concerns. Invalid input, failed input or output operations, and unavailable services still need explicit handling while the application runs.
Choosing the right boundary
C# provides many abstraction tools, so restraint matters as much as capability. A class, interface, or generic is useful only when it makes a contract easier to understand.
| A good signal | A caution signal |
|---|---|
| Several components share a stable contract | A tiny task is hidden behind many layers |
| Managed execution removes routine memory work | Native layout is the central requirement |
| The .NET library solves real infrastructure needs | A framework choice dictates the domain model |
A useful test is simple: the type system and runtime should remove more complexity than the design adds.