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
I don't think you will have much luck trying to shorten it up... to make your event cleaner, you'll type more code to either extend the evententry object to handle comparisons or create a custom class or method to do it... so, it terms of just less code in the one routine on it's own, not much of a chance... sorry.
(If anyone does come up with something, I'd like to see it though... )
I did a quick check, and interestingly enough "1234".Contains("") is True ... go figure, I would have guessed the opposite. Well, good on ya, that saves you a little checking for empty options at any rate
Bookmarks