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

CreateSortKey() private method

Create a sort key that can be compared quickly with other keys.
private CreateSortKey ( string s ) : XmlSortKey
s string
return XmlSortKey
        internal XmlSortKey CreateSortKey(string s)
        {
            SortKey sortKey;
            byte[] bytesKey;

            if (UpperFirst)
            {
                // TODO: Support upper case first on Linux
                // Issues #13926, #13236
                throw new PlatformNotSupportedException(SR.Xslt_UpperCaseFirstNotSupported);
            }

            sortKey = Culture.CompareInfo.GetSortKey(s, _compops);

            // Create an XmlStringSortKey using the SortKey if possible
#if DEBUG
            // In debug-only code, test other code path more frequently
            if (!UpperFirst && DescendingOrder)
                return new XmlStringSortKey(sortKey, DescendingOrder);
#else
            if (!UpperFirst)
                return new XmlStringSortKey(sortKey, DescendingOrder);
#endif

            // Get byte buffer from SortKey and modify it
            bytesKey = sortKey.KeyData;

            return new XmlStringSortKey(bytesKey, DescendingOrder);
        }
    }

Usage Example

 /// <summary>
 /// Create a new sort key and append it to the current run of sort keys.
 /// </summary>
 public void AddStringSortKey(XmlCollation collation, string value) {
     AppendSortKey(collation.CreateSortKey(value));
 }
All Usage Examples Of System.Xml.Xsl.Runtime.XmlCollation::CreateSortKey