Scratching my head. What's wrong with the following statement?
var EncFunc = (encrypt ? Encryption.Encrypt : Encryption.Decrypt);
encrypt is bool, both of the functions Encryption.Encrypt and Encryption.Decrypt have the same type Func<string, string>, but it tells me that:
CS0173 Type of conditional expression cannot be determined because there is no implicit conversion between 'method group' and 'method group'
I have already gone through this and this, but can't understand why compiler cannot determine the type of these 2 functions.
N.B. I know this can be fixed with explicit casting. I'm more interested in understanding the "why" part.