Working with Nulls in C#

Learn how to create, check, access, and eliminate nulls in your C# applications.
Course info
Rating
(26)
Level
Intermediate
Updated
Aug 19, 2019
Duration
2h 9m
Table of contents
Course Overview
Working with Nullable Value Types and Strings
Accessing and Checking for Null Values
Eliminating Null Reference Exceptions
Understanding Non-nullable Reference Types in C# 8
Description
Course info
Rating
(26)
Level
Intermediate
Updated
Aug 19, 2019
Duration
2h 9m
Description

Unexpected null values and NullReferenceExceptions can be a constant source of bugs resulting in wasted time and out of hours support callouts. In this course, Working with Nulls in C#, you'll learn about the different ways that null values pop up in C# code and how to deal with them. First, you'll dive into the fundamentals of why you get null values and the difference between value and reference types. Next, you'll explore how you can use the various C# operators to check for and manipulate nulls. Then, you'll see how to think about nulls at a higher abstraction level in your object-oriented code. Finally, you'll discover how the features introduced in C# 8 can help even more by allowed non-nullable reference types. By the end of this course, you'll understand the different types of objects in C#, how to correctly create nullable value types, how to use C# operators to work with nulls in fewer lines of code, how to implement the Null Object pattern, and how to use nulls in C# 8.

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
Mocking with Moq and NUnit
Intermediate
1h 53m
Feb 22, 2019
More courses by Jason Roberts
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
(Music) Hi everyone! My name is Jason Roberts, and welcome to my course, Working with Nulls in C#. I'm a freelance developer and author. The creator of nulls has called them his billion-dollar mistake, and if you've ever been phoned at 2 a.m. in the morning due to a production outage because of nulls, you'll probably agree with this statement. Nulls can cause a lot of problems, but they can also be a useful construct in your applications. In this course, you'll learn the many different ways to work with null values in C#. Some of the major topics that we'll cover in this course include the difference between value and reference types, how to create nullable value types such as null date/times, how to access and check for null values, how to eliminate null reference exceptions with a specific design pattern, and how to leverage the new features of C# 8 when working with nulls. By the end of this course, you'll know how to create and use null values and how to help prevent null reference exceptions in production. Before beginning the course you should be familiar with basic C# programming. I hope you'll join me on this journey to learn how to manage null values with the Working with Nulls in C# course at Pluralsight.