In C# 6 you can use the Null Conditional Operator. So the original test will be:
int? value = objectA?.PropertyA?.PropertyB?.PropertyC;
More Related Contents:
- Nullable types and the ternary operator: why is `? 10 : null` forbidden? [duplicate]
- Conditional operator assignment with Nullable types?
- What is the difference between Nullable.HasValue or Nullable != null?
- Performance surprise with “as” and nullable types
- Nullable type is not a nullable type?
- How to use .NET reflection to check for nullable reference type
- How to parse a string into a nullable int
- What are lifted operators?
- How to set enum to null
- Type of conditional expression cannot be determined because there is no implicit conversion between ‘int’ and
- How does comparison operator works with null int?
- Ternary operator VB vs C#: why resolves Nothing to zero? [duplicate]
- Linq query with nullable sum
- In C# why can’t a conditional operator implicitly cast to a nullable type
- Why GetType returns System.Int32 instead of Nullable? [duplicate]
- nullable object must have a value
- Where in memory are nullable types stored?
- UnassignedReferenceException even though using the null-conditional operator
- How is the boxing/unboxing behavior of Nullable possible?
- Type result with conditional operator in C#
- What is the default value of the nullable type “int?” (including question mark)?
- Is C# 6 ?. (Elvis op) thread safe? If so, how?
- Boxing / Unboxing Nullable Types – Why this implementation?
- How to get nullable DateTime out of the database
- Correct way to check if a type is Nullable [duplicate]
- What does exclamation mark mean before invoking a method in C# 8.0? [duplicate]
- What’s the difference between ‘int?’ and ‘int’ in C#?
- Serializing a Nullable in to XML
- Why doesn’t the conditional operator correctly allow the use of “null” for assignment to nullable types? [duplicate]
- how are nullable types implemented under the hood in .net?