예제 #1
0
        /// <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)));
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
 string FormatCore(DmdEventInfo @event)
 {
     Write(@event);
     return(writer.ToString());
 }
예제 #4
0
 void Write(DmdEventInfo @event)
 {
     FormatTypeName(@event.EventHandlerType, GetTypeFlags(true) | TypeFlags.FnPtrIsIntPtr);
     writer.Append(' ');
     writer.Append(@event.Name);
 }
예제 #5
0
 public static string Format(DmdEventInfo @event, bool serializable = false)
 {
     using (var formatter = new DmdMemberFormatter(serializable ? GlobalFlags.Serializable : GlobalFlags.None))
         return(formatter.FormatCore(@event));
 }