Hacker News new | ask | show | jobs
by benJIman 5782 days ago
You can always use the null coalescing operator.

(foo as Bar ?? new Bar()).Method();