![C# 6.0 Null Propagation Operators ?. and ?[] C# 6.0 Null Propagation Operators ?. and ?[]](/wp-content/uploads/2015/05/Csharp-6.0.png)
C# 6.0 introduced two new null-propagation operators: ?. and ?[]. They will make null reference check much easier. In this article, we will see how they work and how they implemented internally. We all know about NullReferenceException and how to avoid it in our code. We just need to check everything for null before accessing some fields\properties\methods. Null Propagation Operator ?. var str = GetString(); if (str != null) { return str.Length; } else { return 0; } Now we can use Null Propagati...