Cannot inline temporary variable

I want to inline my temporary variable “isInRange”, but Visual studio doesn’t let me.

The C# compiler sometimes has troubles with certain constructions, and this is one of them. While it looks obvious to us that we mean if the target is null and then if !isInRange, the compiler isn’t as sure. In cases like these, we need to help clarify things for the compiler:

if((target!=null) && !isInRange)
1 Like

Ah, thanks!