示例#1
0
        /// <summary>
        /// Compares to.
        /// </summary>
        /// <param name="obj">
        /// The object.
        /// </param>
        /// <returns>
        /// </returns>
        public override int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            AttributeModel secondSource = obj as AttributeModel;

            // compare on GType first
            return(string.Compare(GType, secondSource.GType, true, System.Globalization.CultureInfo.CurrentCulture));
        }
示例#2
0
        /// <summary>
        /// Compares two objects.
        /// </summary>
        /// <param name="a">
        /// object A.
        /// </param>
        /// <param name="b">
        /// object B.
        /// </param>
        /// <returns>
        /// One, two or three.
        /// </returns>
        public override int Compare(object a, object b)
        {
            if (a is null)
            {
                return(Constants.CompareEquals);
            }

            if (b is null)
            {
                return(Constants.CompareEquals);
            }

            AttributeModel firstAttributeName  = (AttributeModel)a;
            AttributeModel secondAttributeName = (AttributeModel)b;

            // Compare on Surname first
            int testFlag = string.Compare(firstAttributeName.GType, secondAttributeName.GType, StringComparison.CurrentCulture);

            return(testFlag);
        }
示例#3
0
        /// <summary>
        /// Compares the specified two attribute models.
        /// </summary>
        /// <param name="x">
        /// The x.
        /// </param>
        /// <param name="y">
        /// The y.
        /// </param>
        /// <returns>
        /// </returns>
        public int Compare(AttributeModel x, AttributeModel y)
        {
            Contract.Requires(x != null);

            return(Compare(x.GType, y.GType));
        }