Why is this code compiling:
Func<BeExp, IEnumerable<BeExp>> collectFunc;
if (lhs.Kind == BExpKind.BESum)
{
collectFunc = CollectSumTerms;
}
else
{
collectFunc = CollectProdTerms;
}
whereas this is not?
Func<BeExp, IEnumerable<BeExp>> collectFunc = lhs.Kind == BExpKind.BESum ? CollectSumTerms : CollectProdTerms;
Error:
Error CS0173 Type of conditional expression cannot be determined because there is no implicit conversion between 'method group' and 'method group'