/// <summary>
 /// Check if this instance is equal to another object that
 /// implements <see cref="IValueMetaData"/>.
 /// </summary>
 /// <param name="other">
 /// The <see cref="IValueMetaData"/> to check for
 /// equality
 /// </param>
 /// <returns>
 /// True if the two instances are equal.
 /// False otherwise
 /// </returns>
 public bool Equals(IValueMetaData other)
 {
     if (other == null)
     {
         return(false);
     }
     return(GetProperty().Equals(other.GetProperty()) &&
            Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Check if this instance is equal to another object that
 /// implements <see cref="IValueMetaData"/>.
 /// </summary>
 /// <param name="other">
 /// The <see cref="IValueMetaData"/> to check for
 /// equality
 /// </param>
 /// <returns>
 /// True if the two instances are equal.
 /// False otherwise
 /// </returns>
 public bool Equals(IValueMetaData other)
 {
     if (other == null)
     {
         return(false);
     }
     using (var property = GetProperty())
     {
         return(property.Equals(other.GetProperty()));
     }
 }
        /// <summary>
        /// Compare this instance with another object that implements
        /// <see cref="IValueMetaData"/>
        /// </summary>
        /// <param name="other">
        /// The <see cref="IValueMetaData"/> to compare to
        /// </param>
        /// <returns>
        /// &gt;0 if this instance precedes `other` in the sort order.
        /// 0 if they are equal in the sort order.
        /// &lt;0 if `other` precedes this instance in the sort order.
        /// </returns>
        public int CompareTo(IValueMetaData other)
        {
            if (other == null)
            {
                return(-1);
            }
            var difference = GetProperty().CompareTo(other.GetProperty());

            if (difference == 0)
            {
                difference = string.Compare(Name, other.Name,
                                            StringComparison.OrdinalIgnoreCase);
            }
            return(difference);
        }