30% OFF - Use code HANDSON30 for 30% off any course or Dometrain Pro! Browse courses →
  • Courses
  • Learning Paths
  • Blogs
  • Authors
  • Leaderboard
  • 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
    How to handle null with authorization and claims
    05:36
    Improving an API with the DisallowNull attribute
    02:46
    Fixing null issues with null operators
    03:09
    Handling RazorComponents Authorization values
    02:00
    How to handle Null with HttpClient
    05:31
    Updating the application state object
    03:07
    Applying null to Blazor pages
    02:58
    Best practices for loading without relying on null in Blazor
    08:10
    Unpacking the AuthenticationState component
    02:27
    When to use EditorRequired in a RazorComponent
    06:23
    Wrapping up the BlazingPizza walk through
    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

    Getting Started: Model Context Protocol (MCP)
    course

    Getting Started: Model Context Protocol (MCP)

    Learn how to get started with the Model Context Protocol (MCP) and integrate it into your applications.

    Learn more about Getting Started: Model Context Protocol (MCP)
    Hands-On: Learn TypeScript
    course

    Hands-On: Learn TypeScript

    Learn TypeScript through hands-on coding exercises. Practice what you learn with interactive challenges designed for every level.

    Learn more about Hands-On: Learn TypeScript
    Hands-On: Learn JavaScript
    course

    Hands-On: Learn JavaScript

    Learn JavaScript through hands-on coding exercises. Practice what you learn with interactive challenges designed for every level.

    Learn more about Hands-On: Learn JavaScript
    Hands-On: Data Structures & Algorithms in C#
    course

    Hands-On: Data Structures & Algorithms in C#

    Master data structures and algorithms through hands-on coding exercises in C#. Free to enroll for 7 days!

    Learn more about Hands-On: Data Structures & Algorithms in C#
    Blogsmith.ai
    feature

    Blogsmith.ai

    Turn your videos into blogs and newsletters with AI. Check out our new product at blogsmith.ai.

    Learn more about Blogsmith.ai
    Leaderboard
    feature

    Leaderboard

    See how you stack up against other learners. Track your progress, climb the ranks, and compete with the Dometrain community.

    Learn more about Leaderboard
    Hands-On: Learn PostgreSQL
    course

    Hands-On: Learn PostgreSQL

    Learn PostgreSQL through hands-on coding exercises. Practice what you learn with interactive challenges designed for every level.

    Learn more about Hands-On: Learn PostgreSQL
    Free Hands-On: C# for Beginners
    course

    Free Hands-On: C# for Beginners

    Learn C# through hands-on coding exercises. Practice what you learn with interactive challenges designed for everyone, from beginners to experts.

    Learn more about Free Hands-On: C# for Beginners
    Getting Started: AI for .NET Developers
    course

    Getting Started: AI for .NET Developers

    Get started with integrating AI into your .NET applications effectively using the latest LLM best practices.

    Learn more about Getting Started: AI for .NET Developers
    Getting Started: Building .NET Applications on AWS
    course

    Getting Started: Building .NET Applications on AWS

    Learn how to build and deploy .NET applications on AWS using CDK, Lambda, DynamoDB, S3, and more.

    Learn more about Getting Started: Building .NET Applications on AWS
    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 about What's new in C# 14
    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 about Let's Build It: AI Chatbot with RAG in .NET Using Your Data
    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 about From Zero to Hero: SignalR in .NET
    Deep Dive: Solution Architecture
    course

    Deep Dive: Solution Architecture

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

    Learn more about Deep Dive: Solution Architecture
    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 about Migrating: ASP.NET Web APIs to ASP.NET Core
    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 about Getting Started: Caching in .NET
    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 about From Zero to Hero: Testing with xUnit in C#
    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 about Create a ChatGPT Console AI Chatbot in C#