I'm basically trying to convert this:
private int FindIndexOf(string valueOne, string valueTwo, List<string> list)
{
return list.FindIndex(s =>
s.ToLower().Contains(valueOne.ToLower()) &&
s.ToLower().Contains(valueTwo.ToLower())
);
}
to make use of params like this:
private int FindIndexOf(List<string> list, params string[] args)
{
string pattern = String.Format("([{0}]+)", String.Join("]+[", args));
Regex regEx = new Regex(pattern, RegexOptions.IgnoreCase);
return list.FindIndex(s => regEx.IsMatch(s.ToLower()));
}
I'm not very good with RegEx and I can't think of a way to implement this in linq. Any suggestions?