CategoriesType System

Type System

6 features across 5 C# versions

C# 2.02005

Generics (<T>)

Implements type-safe parameters directly into metadata structures, entirely mitigating overhead from casting and runtime memory boxing.

1public class DataStack<T> {
2 private List<T> _items = new List<T>();
3 public void Push(T item) => _items.Add(item);
4}
C# 2.02005

Nullable Value Types (int?)

Enables struct values to natively hold or evaluate a null state, heavily optimizing database storage handling.

1int? currentScore = null;
2bool hasValue = currentScore.HasValue;
C# 42010

Dynamic Evaluation (dynamic)

Bypasses strict compile checks to resolve targets directly during operations using the Dynamic Language Runtime helper paths.

1dynamic flexiblePayload = GetPayload();
2flexiblePayload.ExecuteAction();
C# 72017

Pattern Matching Type Checks

Integrates conditional object evaluation directly within target assignment code loops.

1if (vehicle is Truck t && t.CargoWeight > 5000) { /* Process */ }
C# 82019

Nullable Reference Types

Forces fields to be treated as non-nullable unless marked with an explicit query tag, optimizing runtime type safety.

1#nullable enable
2string mandatoryName = "Safe";
3string? optionalNotes = null;
C# 132024

Ref Struct Interface Implementations

Enables highly volatile ref struct types to cleanly implement generic interfaces or act as strict argument limits.

1public ref struct CustomValidator : IDisposable {
2 public void Dispose() { }
3}