C# 6.0 includes a new null-conditional operator (sometimes called the Safe Navigation Operator):
In previous versions null checking for any kind of objects manually we need to write if condition then we need to write our required properties or else we need to write our business logic.
- If(Object != null)
- {
- If(Object.User != null)
- {
- return object.User.Name;
- } Else
- {
- return null;
- }
- }
- return object!=null? (object.user!=null?object.User.Name:null):null;
- return object?.user?. Name;

Join the conversation! Your thoughts help the community grow.