I'm building a small tool to help me filter data in a massive logfile (about 4.5 million lines). In order to filter these results, I'm using searchparameters which should either be included in the search or excluded from the search results.
I'm reading the logfile line by line due to memory space restrictions. For each line I'm checking if the neccessary conditions are met. So it looks something like this:
if (line.Contains(parameterToInclude1) && line.Contains(parameterToInclude2) && !line.Contains(parameterToExclude1) && !line.Contains(parameterToExclude2))
Hard-coded it works fine, however I'm trying to make this dynamic by allowing the user to add parameters to include and exclude.
For this I'm using a class called SearchParametersClass
public class SearchParametersClass
{
public List<string> included { get; set; }
public List<string> excluded { get; set; }
}
The question is now, how can I make my code so it checks if the line contains the different parameters from the Included list and excludes the parameters from the Excluded list?
Thanks