I want to pass a Func<IList<object>, int>
to a method that takes a Func<IEnumerable<object>, int>
. Can't seem to work it out. Is it possible to do something like below?
class A {
void Test() {
IList<object> data = new List<object>();
// can't pass in MyFunc, doesn't compile
ApplyFunc(MyFunc, data);
}
int MyFunc(IList<object> data) {
return 0;
}
void ApplyFunc(Func<IEnumerable<object>, int> f, IList<object> data) {
f(data);
}
}