I have two blocks of code that I would like to think equal:
Block first if

Then the same thing, but converted to a switch type by type. (sorry for the unsuccessful reddish red markers of Resharper, Resharper still doesn’t understand this)

Switch-based code will throw a Null reference exception in the first return Actor.Done, which is not null.
Is this a template matching error or is there some kind of semantics that I'm missing here?
[edit]
I found a fix for it.
Change this:
case MessageEnvelope env:
to
case MessageEnvelope _:
var env = m as MessageEnvelope;
Does it all. So this leaves me wondering if these lines should be the same?
source
share