The part that concerns me is the accessing of the function 'Length' when you don't really know that the new String has actually been created.
You absolutely know that the new String has been created before Length is called. An exception will be thrown if the String could not be created.
[Edge case ahead.]
Now, in the case of
the instance of MyObject
may be garbage collected before LongRunningMethod returns. This usually doesn't cause a problem, but it can; to cause a problem usually involves a questionable design decision (e.g., a disposed
MyObject cleans up a field, and this
happens to occur after LongRunningMethod's last reference to your
MyObject instance but before using a locally stored reference to that field). I can make it happen but I don't expect to see it in the wild.