C# Null-Conditional Operator (? Operator) Explained!

preview_player
Показать описание
To make your C# code more readable, the null-conditional operator has been introduced in C# version 6. With this operator you can simply type a question mark after an object reference to check it for null. In this video I will show you what it does and how to use it.

💝 Join this channel to get access to perks:

🔗 Links

⏱ Timestamps
00:00 - Intro
00:26 - Quick Explanation Through Docs Page
02:56 - Null-Conditional Operators Explained
04:30 - Null-Conditional Operator on Properties
07:34 - Chaining Null-Conditional Operators
09:44 - Null-Conditional Operators on Arrays
12:18 - Outro

🙋‍♂️ Also find my...

#csharp #nullconditional #dotnet #questionmark
Рекомендации по теме
Комментарии
Автор

I came here to resolve a question and I left with another. I did not know that it was possible to define an object of the same class within the definition of the class itself. Either way, thanks for resolving my concerns about Null-conditional operators

jaimemenendezalvarez
Автор

good tips...
and now we also know that Gerald loves gardening ^_^

itamarcus
Автор

I often use combo of operators ?. and ?? . It`s useful if need to react on null like ?? "A person has no name");

klasseka
Автор

Does it make sense to declare properties with the ? operator? For example, public class foo{ public string bar? {get; set; } }. If so - how do you assign to bar?

MrBigdogtim