csharp inline question mark on object

Code Example - csharp inline question mark on object

                
                        public class A {
  string PropertyOfA { get; set; }
}

A myA = null;
var foo = "bar";
string bar = (a == null ? null : a.PropertyOfA);
// both the same
if (a?.PropertyOfA != foo || bar != foo)
{
    // do something
}