System.Xml.Xsl.Runtime.XmlCollation.Compare C# (CSharp) Method

Compare() private method

Compare two strings with each other. Return <0 if str1 sorts before str2, 0 if they're equal, and >0 if str1 sorts after str2.
private Compare ( string str1, string str2 ) : int
str1 string
str2 string
return int
        internal int Compare(string str1, string str2) {
            CultureInfo cultinfo = Culture;
            int result;

            if (this.options.Ordinal) {
                result = string.CompareOrdinal(str1, str2);
                if (result < 0) result = -1;
                else if (result > 0) result = 1;
            }
            else if (UpperFirst) {
                // First compare case-insensitive, then break ties by considering case
                result = cultinfo.CompareInfo.Compare(str1, str2, this.compops | CompareOptions.IgnoreCase);
                if (result == 0)
                    result = -cultinfo.CompareInfo.Compare(str1, str2, this.compops);
            }
            else {
                result = cultinfo.CompareInfo.Compare(str1, str2, this.compops);
            }

            if (DescendingOrder)
                result = -result;

            return result;
        }