today I was wondering if there is a better solution perform the following code sample.
string keyword = \" abc, foo , bar\"; string match = \"foo\"; str
Another possible option (that avoids LINQ, for better or worse):
string line = " abc, foo , bar"; string[] parts= Array.ConvertAll(line.Split(','), p => p.Trim());
However, if you just need to know if it is there - perhaps short-circuit?
bool contains = line.Split(',').Any(p => p.Trim() == match);