I am writing an EventLog filter. Users will be able to enter values for Source, EventID, Category and the message itself. All values would be optional. Anyway, when the EntryWrittenEventHandler is written, I would like to check the entry to see if it meets the parameters written by the user (all of which will be stored in string variables).

If I was only checking the source, I could use something like
Code:
private void EventLog_EntryWritten(object sender, EntryWrittenEventArgs e)
{
	string userSource = "MySearchString";
	
	if (e.Entry.Source.ToLower() == userSource)
	{
		\\ do something
	}
}
But if I want to check more user options, I would need to do something like
Code:
private void EventLog_EntryWritten(object sender, EntryWrittenEventArgs e)
{
	string userSource = "MySearchString";
	string userCategory = "MyCategory";
	string userEventID = "MyEventId";
	string userMessage = "MyMessage";
	
	if (e.Entry.Source == userSource && e.Entry.Category = userCategory etc...)
	{
		\\ do something
	}
}
What I'm looking for is some short clever way to AND together all the user options that have been set, but ignore any that have not been set.