throw and Custom Exceptions in C# — a practical guide to C# custom exceptions with clear examples you can reuse in real projects.
C# Tutorial Series (89/121). Prefer one article? Read the complete C# tutorial.
Short description
Don’t over-create custom exceptions — use existing BCL types when they fit.
Custom exception tip
class OrderNotFoundException : Exception
{
public OrderNotFoundException(string id) : base($"Order {id} not found") {}
}