Cannot convert type 'System.Func<int,bool>' to 'System.Func<object,bool>'
Trying to cast f2 to f1:
Func<object, bool> f1 = x => true;
Func<int, bool> f2 = x => true;
f1 = (Func<object, bool>)f2;
Tried map function to solve but, this time i get
Argument 1: cannot convert from 'C' to 'A'
exception. on tranform(a) function
Func<int, bool> f3 = Map(f2, x => x);
Func<C, B> Map<A, B, C>(Func<A, B> input, Func<A, C> transform)
{
return x => input(transform(x));
// return x => input(transform((A)x)); not working
}
Is there a solution?