Stage 1 · Lesson 5 of 10
Exceptions and nullable types
C# signals failure with exceptions. Throw a specific type, catch only what you can handle, and use using statements so connections and files are closed even on error. Create your own exceptions for business errors, such as OrderNotFoundException.
can later turn those into a in one place. are the other half of this topic. Put <Nullable>enable</Nullable> in the project file.
Then string means "never null" and string? means "maybe null". The compiler warns you when you use something that might be null. Treat those warnings as errors.
Common trapsilencing them with the ! operator everywhere, which removes the safety net and brings back the NullReferenceException it was meant to prevent.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with
- GuideFreeLearn C#
Microsoft · Beginner
Official C# tutorials from the language basics through classes, LINQ and async
Practise
Keep handy
Also worth your time
The DNS, TCP, TLS and HTTP steps behind every request your backend will handle