null shorthand in C#?
c#, null
Solution
Try this:
bool pass = d != null && (bool)(d["k"] ?? false);
Problem
Is there a way to make this line shorter? ``` bool pass = d != null && d["k"] != null && (bool)d["k"]; ``` Note: "k" is actually "a longer id"; I replaced it to make it more readable in this post. Many of your suggestions don't check whether d is null.