C# Nullable reference types – No more null reference exceptions!

preview_player
Показать описание
Are you tired of null reference exceptions and unexpected crashes due to uninitialized variables? There’s a very handy feature in C# called nullable references types that will help you catch this before it becomes a problem!

In this video we are exploring nullable reference types in C#. This is a great addition to the C# language!

This language feature was first introduced in C# 8.0 and is a great way to find potential problems, before it becomes an issue!

Enable nullable reference types in your project by modifying the csproj file.

This video also includes details on how to use the C# 9.0 language features 'new expression' and 'init only setters'.

Table of contents:
00:00 Introduction
00:33 Why do null reference exceptions occur?
01:14 C# 9.0: 'new expression'
04:29 Nullable Reference Types
05:06 Nullable Reference Type Syntax
05:21 Enable the Nullable Reference Types on the Project level
05:56 Compiler Warnings
06:33 Introducing a Nullable Reference Type
09:07 More Compiler Warnings
09:55 Damn it/Null forgiving operator
12:39 C# 9.0: Init only setters
15:34 Enable the Nullable REference Types using Directives
16:04 Summary

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the links, I may receive a small commission.
Рекомендации по теме
Комментарии
Автор

This is super useful to get into the compiler. I bet probably 80% of the exceptions I encounter are Null Reference Exceptions. Also I shoutout to a quick Yield video.

Mosern
Автор

Wow, your way of presenting information is just phenomenal.

uncommonbg
Автор

Like your content! Please add a video on Events and Delegates.

jaswantbisane
Автор

very informative, what a great Teacher <3

Al-mansur
Автор

Thanks soooo much I needed to hear the first part where you have to use new to allocate an instance. Thanks for the info, your a life saver.

saeedsubhani
Автор

thank you for a great presentation, it simplified and understanding the work with issue nullable and very handy with key features in C#9

GBG
Автор

You make me recheck all my projects and rethink about nullable types. Thanks for the info shared.

Time
Автор

Very good and clear explanation. Thank you.

spyros
Автор

Thanks for the great content. That would be more great if you get to "yield" later in another video. Cheers!

niloo
Автор

I’m starting out with c# kinda and am going through a c# book and doing the activities when I seen an null warning and wanted to see what it meant and ways to fix it. Great vid

rady
Автор

Hi, thank you for this great video. It's easy to understand 👍

I also agree that your next vid should be the yield keyword :)

qwerty
Автор

Thanks for delivering deep diving leacture 👍

chandanpandey
Автор

You are providing very good explanations!!! Please publish more videos in the future.

MrLucki
Автор

Great video super useful. It would be great to have a video on yield!!!

sonomirco
Автор

Watched your async course on Pluralsight, best C# tutorial author and tutor!

bns
Автор

Very good video. Hope you make many more.

shubhamshukla
Автор

Omg! Perfect. Not indian english. Thank you for the content!

zerg
Автор

OMG, You make such a good content, I like you!

zankomag
Автор

Thank you for the clear explanation .What is the use of #nullable restore and when to use it?

chammu
Автор

Very clear thanks.

Using Nullable Ref Types with EF POCO classes feels awkward, I've been suppressing it with the null forgivable operator, but maybe 'init' from C#9 will improve this?

And yes for Yield

fishzebra