Expanded

Working with Nulls in C#

Unexpected null values and NullReferenceExceptions can be a constant source of bugs resulting in wasted development time and out-of-hours support callouts. This course will teach you how to reduce null related errors in your code.
Course info
Level
Advanced
Updated
Aug 13, 2021
Duration
2h 31m
Table of contents
Course Overview
Working with Nullable Value Types and Strings
Accessing and Checking for Null Values
Eliminating Null Reference Exceptions with the Null Object Pattern
Understanding Nullable and Non-nullable Reference Types
Using Additional Attributes to Describe Nullability
Description
Course info
Level
Advanced
Updated
Aug 13, 2021
Duration
2h 31m
Description

Making use of an object when it is not supposed to be null can result in unexpected exceptions that can cause your program to crash. These unexpected null related errors may cause data loss or corruption, system downtime, and unhappy users. In this course, Working with Nulls in C#, you’ll gain the ability to reduce the likelihood of getting null related exceptions in production. First, you’ll explore which objects can be set to null and how to check for null values. Next, you’ll discover a design pattern to help eliminate null related exceptions. Finally, you’ll learn how to opt-in to the ability to create non-nullable reference types that enable the compiler to detect null-related problems before you even run your application. When you’re finished with this course, you’ll have the skills and knowledge of nulls in C# needed to reduce null related errors in your production code.

About the author
About the author

With over 15 years experience, Jason Roberts is a Microsoft .NET MVP, freelance developer, and author.

More from the author
Working with Files and Streams in C#
Intermediate
3h 25m
Jun 2, 2021
Exception Handling in C#
Intermediate
1h 44m
Mar 22, 2021
More courses by Jason Roberts
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name's Jason Roberts, and welcome to my course, Working with Nulls in C#. I'm a freelance developer and author. Unexpected null values and NullReferenceExceptions can be a constant source of bugs resulting in wasted development time and out‑of‑hours support callouts. C# does, however, provide many different ways to help prevent applications from crashing due to these null‑related exceptions. In this course we're going to learn how to greatly reduce the likelihood of getting null‑related errors in production by making use of these features. Some of the major topics that we'll cover include the difference between reference, value, and nullable value types; the different C# operators we can use to make working with nulls easier; a design pattern that we can use to help eliminate null reference exceptions; and how we can create reference types that can't accidentally be set to null. By the end of this course, you'll know how to use the different features of C# to reduce null‑related errors in your code. Before beginning the course, you should be familiar with basic C# syntax. I hope you'll join me on this journey to learn C# with the Working with Nulls in C# course, at Pluralsight.