I think this has something to do with the whole variance thing, but I don't quite get why this isn't allowed.
I have a method
public void method(Func<Enum, String> func)
And I have a few different methods such as
public String doSomething(someEnum)
public String doSomethingElse(someOtherEnum)
I want to make calls like this
method(doSomething)
method(doSomethingElse)
but I get these errors
convert from 'method group' to
System.Func<System.Enum,string>
What is the reason this cannot be done? Do I really need to rewrite method into multiple methods like this?
public void method(Func<someEnum, String> func)
public void method(Func<someOtherEnum, String> func)
That's really ugly.
edit:
I want to do something like this in the method (note in my actual code, enumType is also passed in as a Type)
foreach (Enum val in Enum.GetValues(enumType))
{
func(val);
}