예제 #1
0
        /// <summary>
        /// Compares two properties
        /// </summary>
        /// <param name="a">First property</param>
        /// <param name="b">Second property</param>
        /// <returns></returns>
        public bool Equals(DmdPropertyInfo a, DmdPropertyInfo b)
        {
            if ((object)a == b)
            {
                return(true);
            }
            if ((object)a == null || (object)b == null)
            {
                return(false);
            }

            return(MemberNameEquals(a.Name, b.Name) &&
                   Equals(a.GetMethodSignature(), b.GetMethodSignature()) &&
                   (!CompareDeclaringType || Equals(a.DeclaringType, b.DeclaringType)));
        }
예제 #2
0
        /// <summary>
        /// Gets the hash code of a property
        /// </summary>
        /// <param name="a">Property</param>
        /// <returns></returns>
        public int GetHashCode(DmdPropertyInfo a)
        {
            if ((object)a == null)
            {
                return(0);
            }

            int hc = MemberNameGetHashCode(a.Name);

            hc ^= GetHashCode(a.GetMethodSignature());
            if (CompareDeclaringType)
            {
                hc ^= GetHashCode(a.DeclaringType);
            }
            return(hc);
        }
예제 #3
0
 string FormatCore(DmdPropertyInfo property)
 {
     Write(property);
     return(writer.ToString());
 }
예제 #4
0
 void Write(DmdPropertyInfo property) => WriteMethod(property.Name, property.GetMethodSignature(), genericArguments: null, isMethod: false);
예제 #5
0
 public static string Format(DmdPropertyInfo property, bool serializable = false)
 {
     using (var formatter = new DmdMemberFormatter(serializable ? GlobalFlags.Serializable : GlobalFlags.None))
         return(formatter.FormatCore(property));
 }