• Courses
  • TutorialsFree
  • Learning Paths
  • Blogs
  • Authors
  • Dometrain Pro
  • Shopping Basket

    Your basket is empty

  • Business Portal
  • From Zero to Hero: Working with Null in C#

    Learn how to properly use null in C# in a modern way and write better, robust code

    About This Course

    Null is often called the billion-dollar mistake, and for good reason. It can be very problematic. The idea of something having a nothing value sounds dangerous in software engineering. Over the years, C# has introduced features such as Nullable Reference Types to help developers write better, more robust, and safe code, but many people still don't know how to use it properly. In this course, Ed Charbeneau will start with the basics and teach you everything there is to know about null, from how to use it, from when not to use and how to take an existing full stack application that isn't using it properly and re-engineer it to make full use of the feature.

    Course Curriculum

    4h 38m 8 sections
    Welcome
    00:45 Free preview
    Who is the course for and prerequisites
    00:43 Free preview
    What will you learn in this course?
    02:05 Free preview
    Why is null important in C#?
    01:43
    Why is null a problem in C#?
    04:24
    The C# type system and value types
    04:10
    Reference types in C#
    03:14
    Unpacking the default keyword
    03:52
    How C# uses types on the heap and stack
    05:20
    A brief history of null in C#
    00:52
    Nullable value types in C# 2+
    11:13
    Nullable reference types in C# 8+
    05:44
    Setting the nullable context
    03:24
    Understanding common null compiler warnings
    11:34
    Null intent is for compilers and developers too
    09:33
    What is the null conditional operator?
    06:26
    Using the null conditional operator with arrays
    07:02
    What is null conditional short-circuiting?
    03:05
    What is the null coalescing operator?
    06:10
    What is the null coalescing conditional operator?
    06:01
    What is the null forgiving operator?
    06:30
    API design with null intent introduction
    01:16
    Working with null and properties
    05:01
    Unpacking the "Exiting the constructor" null warning
    05:37
    What is the required keyword, and when to use it
    05:19
    Advanced API intent with the AllowNull attribute
    03:30
    Advanced API intent with the DisallowNull attribute
    06:54
    Advanced API intent with the MemberNotNull attribute
    04:58
    Advanced API intent with the NotNullIfNotNull attribute
    03:18
    Introduction to pattern matching and the `is` keyword
    06:04
    Property matching to filter null
    10:40
    Capturing null with the pattern matching switch operator
    05:16
    The BlazingPizza project overview
    01:45
    Enabling the nullable context and treating warnings as errors
    04:27
    How null affects EF migrations
    07:43
    How null affects EF relationships
    07:25
    Using the Visual Studio references feature to find null intent
    06:34
    How null affects full-stack objects
    04:02
    When to use the required keyword
    05:46
    Updating shared classes with proper null intent
    09:59
    Shared library walkthrough wrap up
    06:10
    Web API best practices, GET operations
    03:50
    Web API best practices, PUT operations
    04:20
    Web API best practices, POST operations
    02:05
    Web API best practices, DELETE operations
    00:58
    Sample project only (no start and finish for this one)
    05:36
    How to handle null with authorization and claims
    02:46
    Improving an API with the DisallowNull attribute
    03:09
    Fixing null issues with null operators
    02:00
    Handling RazorComponents Authorization values
    05:31
    How to handle Null with HttpClient
    03:07
    Updating the application state object
    02:58
    Applying null to Blazor pages
    08:10
    Best practices for loading without relying on null in Blazor
    02:27
    Unpacking the AuthenticationState component
    06:23
    When to use EditorRequired in a RazorComponent
    08:34

    Meet Your Instructor

    Ed Charbeneau

    Ed Charbeneau

    Ed is a Microsoft MVP and an international speaker, writer, online influencer, a Developer Advocate for Progress, and expert on all things web development. Ed enjoys geeking out to cool new tech, brainstorming about future technology, and admiring great design.

    View all courses by Ed Charbeneau

    What's New

    What's new in C# 14
    blog

    What's new in C# 14

    This guide covers every new C# 14 feature, explains its benefits, and provides practical code examples to help you navigate how you can use them.

    Learn More
    Let's Build It: AI Chatbot with RAG in .NET Using Your Data
    course

    Let's Build It: AI Chatbot with RAG in .NET Using Your Data

    Build a Retrieval-Augmented Generation (RAG) chatbot that can answer questions using your data.

    Learn More
    Working with Large Language Models
    tutorial

    Working with Large Language Models

    Learn how to work with Large Language Models (LLMs). Understand the fundamentals of how GPT works, the transformer architecture, and master prompt engineering techniques to build AI agents.

    Learn More
    From Zero to Hero: SignalR in .NET
    course

    From Zero to Hero: SignalR in .NET

    Enable enterprise-grade real-time communication for your web apps with SignalR.

    Learn More
    Deep Dive: Solution Architecture
    course

    Deep Dive: Solution Architecture

    Master solution architecture and turn business needs into scalable, maintainable systems.

    Learn More
    Migrating: ASP.NET Web APIs to ASP.NET Core
    course

    Migrating: ASP.NET Web APIs to ASP.NET Core

    A step-by-step process to migrate ASP.NET Web APIs from .NET Framework to ASP.NET Core.

    Learn More
    Getting Started: Caching in .NET
    course

    Getting Started: Caching in .NET

    Let's make the hardest thing in programming easy for .NET software engineers.

    Learn More
    From Zero to Hero: Testing with xUnit in C#
    course

    From Zero to Hero: Testing with xUnit in C#

    Learn how to test any codebase in .NET with the latest version of xUnit, the industry-standard testing library.

    Learn More
    Create a ChatGPT Console AI Chatbot in C#
    blog

    Create a ChatGPT Console AI Chatbot in C#

    This walkthrough is your hands-on entry point to create a basic C# console application that talks to ChatGPT using the OpenAI API.

    Learn More