示例#1
0
        private void InitSort(CultureInfo culture)
        {
            _sortName = culture.SortName;

            if (GlobalizationMode.Invariant)
            {
                _isAsciiEqualityOrdinal = true;
            }
            else
            {
                _isAsciiEqualityOrdinal = (_sortName == "en-US" || _sortName == "");

                _sortHandle = SortHandleCache.GetCachedSortHandle(_sortName);
            }
        }
示例#2
0
        private void IcuInitSortHandle()
        {
            if (GlobalizationMode.Invariant)
            {
                _isAsciiEqualityOrdinal = true;
            }
            else
            {
                Debug.Assert(!GlobalizationMode.UseNls);

                // Inline the following condition to avoid potential implementation cycles within globalization
                //
                // _isAsciiEqualityOrdinal = _sortName == "" || _sortName == "en" || _sortName.StartsWith("en-", StringComparison.Ordinal);
                //
                _isAsciiEqualityOrdinal = _sortName.Length == 0 ||
                                          (_sortName.Length >= 2 && _sortName[0] == 'e' && _sortName[1] == 'n' && (_sortName.Length == 2 || _sortName[2] == '-'));

                _sortHandle = SortHandleCache.GetCachedSortHandle(_sortName);
            }
        }