Answers for "C# inline question mark on object"

C#
1

C# 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
}
Posted by: Guest on August-27-2021

Code answers related to "C# inline question mark on object"

C# Answers by Framework

Browse Popular Code Answers by Language