/// <summary> /// Compares two events /// </summary> /// <param name="a">First event</param> /// <param name="b">Second event</param> /// <returns></returns> public bool Equals(DmdEventInfo a, DmdEventInfo b) { if ((object)a == b) { return(true); } if ((object)a == null || (object)b == null) { return(false); } return(MemberNameEquals(a.Name, b.Name) && Equals(a.EventHandlerType, b.EventHandlerType) && (!CompareDeclaringType || Equals(a.DeclaringType, b.DeclaringType))); }
/// <summary> /// Gets the hash code of an event /// </summary> /// <param name="a">Event</param> /// <returns></returns> public int GetHashCode(DmdEventInfo a) { if ((object)a == null) { return(0); } int hc = MemberNameGetHashCode(a.Name); hc ^= GetHashCode(a.EventHandlerType); if (CompareDeclaringType) { hc ^= GetHashCode(a.DeclaringType); } return(hc); }
string FormatCore(DmdEventInfo @event) { Write(@event); return(writer.ToString()); }
void Write(DmdEventInfo @event) { FormatTypeName(@event.EventHandlerType, GetTypeFlags(true) | TypeFlags.FnPtrIsIntPtr); writer.Append(' '); writer.Append(@event.Name); }
public static string Format(DmdEventInfo @event, bool serializable = false) { using (var formatter = new DmdMemberFormatter(serializable ? GlobalFlags.Serializable : GlobalFlags.None)) return(formatter.FormatCore(@event)); }