I have the following method definition (EDITED to remove redundant generic):
public static T SearchAgaistValues<T>(Dictionary<string, string> input,
string key, List<T> values, Predicate<T> match, out string[] cmdParams)
My simplified requirements are as follows. I need to search input
for key
, and if found, see if its value appears in values
. However, values
is generic (and will obviously contain a string that I need to match). Therefore, the way I see it, I have to pass a predicate method to perform the matching.
However, every example of Predicate<T>
I have seen has a hard coded comparitor. I need to compare the found key's
value to each item in values
. I cannot pass these values, however.
I can't see how to do this outside of a foreach loop with a delegate based match method.
Am I missing something here?