I have a func which takes one parameter of Type T and returns one value.
I want to store it in a dictionary, like so:
Dictionary<CustomerMilestones, Func<string, string>> coll = new Dictionary<CustomerMilestones, Func<string, string>>(); string Indicator = coll[CustomerMilestones.Ordered100Products].Invoke(customerId.ToString()); coll.Add(CustomerMilestones.Ordered100Products, Execute(Indicator);
Execute is a method which takes a string but also returns a string. On the last line, the error is as follows:
Argument type string is not assignable to parameter type Func.
What am I doing wrong?
You shouldn’t be calling Execute – you just need to provide it as a method group: