/// <param name="eventType">Must be a <see cref="EventLog"/> type with a matching event signature attribute.</param> public static bool TryParse(this FilterLogObject log, Type eventType, out EventLog eventLog) { var sig = GetEventLogTypeSignature(eventType); if (sig == null || sig != log.Topics[0].GetHexString(hexPrefix: false)) { eventLog = null; return(false); } eventLog = (EventLog)Activator.CreateInstance(eventType, log); return(true); }
public static bool TryParse <TEventLog>(this FilterLogObject log, out TEventLog eventLog) where TEventLog : EventLog { var sig = GetEventLogTypeSignature <TEventLog>(); if (sig == null || sig != log.Topics[0].GetHexString(hexPrefix: false)) { eventLog = null; return(false); } eventLog = (TEventLog)Activator.CreateInstance(typeof(TEventLog), log); return(true); }