/// <summary> /// Determines whether the specified cache are equal. /// </summary> /// <param name="x">The first object of type <typeparamref name="TAtt" /> to compare.</param> /// <param name="y">The second object of type <typeparamref name="TAtt" /> to compare.</param> /// <returns> /// true if the specified objects are equal; otherwise, false. /// </returns> public bool Equals(IPropertyInfoCache <TAtt> x, IPropertyInfoCache <TAtt> y) { if (x == null && y == null) { return(true); } if (x == null || y == null) { return(false); } if (x.PropertyInfo == null && y.PropertyInfo != null || y.PropertyInfo == null && x.PropertyInfo != null) { return(false); } if (x.PropertyInfo.DeclaringType.FullName != y.PropertyInfo.DeclaringType.FullName) { return(false); } if (x.PropertyName != y.PropertyName) { return(false); } return(true); }
/// <summary> /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. /// </summary> /// <param name="x">The first object to compare.</param> /// <param name="y">The second object to compare.</param> /// <returns> /// A signed integer that indicates the relative values of <paramref name="x" /> and <paramref name="y" />, as shown in /// the following table.Value Meaning Less than zero<paramref name="x" /> is less than <paramref name="y" />.Zero /// <paramref name="x" /> equals <paramref name="y" />.Greater than zero<paramref name="x" /> is greater than /// <paramref name="y" />. /// </returns> public int Compare(IPropertyInfoCache <TAtt> x, IPropertyInfoCache <TAtt> y) { if (x == null) { return(-1); } if (y == null) { return(+1); } return(x.GetHashCode() - y.GetHashCode()); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <param name="other">An object to compare with this object.</param> /// <returns> /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false. /// </returns> public bool Equals(IPropertyInfoCache <TAtt> other) { return(new PropertyEquatableComparer <TAtt>().Equals(this, other)); }
/// <summary> /// Compares the current instance with another object of the same type and returns an integer that indicates whether /// the current instance precedes, follows, or occurs in the same position in the sort order as the other object. /// </summary> /// <param name="other">An object to compare with this instance.</param> /// <returns> /// A value that indicates the relative order of the objects being compared. The return value has these meanings: Value /// Meaning Less than zero This instance precedes <paramref name="other" /> in the sort order. Zero This instance /// occurs in the same position in the sort order as <paramref name="other" />. Greater than zero This instance follows /// <paramref name="other" /> in the sort order. /// </returns> public int CompareTo(IPropertyInfoCache <TAtt> other) { return(new PropertyEquatableComparer <TAtt>().Compare(this, other)); }
/// <summary> /// Returns a hash code for the given cache. /// </summary> /// <param name="obj">The object.</param> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public int GetHashCode(IPropertyInfoCache <TAtt> obj) { return(obj.PropertyInfo.GetHashCode()); }