/// <summary> /// Compare this instance to another ConfiguratorAttribute. /// </summary> /// <param name="obj">the object to compare to.</param> /// <returns>see <see cref="IComparable.CompareTo"/>.</returns> /// <remarks> /// <para> /// Compares the priorities of the two <see cref="ConfiguratorAttribute"/> instances. /// Sorts by priority in descending order. Objects with the same priority are /// randomly ordered. /// </para> /// </remarks> public int CompareTo(object obj) { // Reference equals if ((object)this == obj) { return(0); } int result = -1; ConfiguratorAttribute target = obj as ConfiguratorAttribute; if (target != null) { // Compare the priorities result = target.m_priority.CompareTo(this.m_priority); if (result == 0) { // Same priority, so have to provide some ordering result = -1; } } return(result); }
public int CompareTo(object obj) { if (ReferenceEquals(this, obj)) { return(0); } int num = -1; ConfiguratorAttribute attribute = obj as ConfiguratorAttribute; if (attribute != null) { num = attribute.m_priority.CompareTo(this.m_priority); num ??= -1; } return(num); }
/// <summary> /// Compare this instance to another ConfiguratorAttribute /// </summary> /// <param name="obj">the object to compare to</param> /// <returns>see <see cref="M:System.IComparable.CompareTo(System.Object)" /></returns> /// <remarks> /// <para> /// Compares the priorities of the two <see cref="T:log4net.Config.ConfiguratorAttribute" /> instances. /// Sorts by priority in descending order. Objects with the same priority are /// randomly ordered. /// </para> /// </remarks> public int CompareTo(object obj) { if (this == obj) { return(0); } int num = -1; ConfiguratorAttribute configuratorAttribute = obj as ConfiguratorAttribute; if (configuratorAttribute != null) { num = configuratorAttribute.m_priority.CompareTo(m_priority); if (num == 0) { num = -1; } } return(num); }