Yes, there is the coalesce operator in C# that does almost exactly this.
return myObject ?? new Object();
EDIT: This does not change the variable myObject
. If you want to do this as well, you can simply write
return myObject = myObject ?? new Object();
because an assignment in C# is also an expression that returns the value that has been assigned.