C# Null PropagatorC# Null Propagator is an operator. It is used to check null value in an object reference chain. This operator is a combination of two symbols, question mark (?) and comma (,). In C# code, if we call a method or property by using null object, compiler throws System.NullReferenceException exception. We receive this exception if we don't check for null in our code. To avoid this exception, we can use null propagator operator. In the following example, we are checking for null reference, by using if block, before calling a method. C# Example without using Null PropagatorOutput Rahul Kumar In the following example, we are using Null Propagator Operator to check null reference. C# Example with Null Propagator OperatorOutput PETER [email protected] Name is empty Email is empty Next TopicC# String Interpolation |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India