Why explicit cast is required in Conditional operator
_doSomething = ThisOrThat ? DoThis : DoThat;
From this answer from Jon Skeet:
as the expression. What's the type of that? What delegate type should the method groups be converted to? The compiler has no way of knowing. If you cast one of the operands, the compiler can check that the other can be converted though
For your question:
Why it is allowed in
if
statement
You are doing a simple assignment where left hand side is Action
and the right hand side is a method group. There exists implicit conversion
The assignment operator (=) stores the value of its right-hand operand in the storage location, property, or indexer denoted by its left-hand operand and returns the value as its result. The operands must be of the same type (or the right-hand operand must be implicitly convertible to the type of the left-hand operand)