Beispiel #1
0
        /// <summary>
        /// Constructor called by SQL Server's special munged culture - creates a culture with
        /// a TextInfo and CompareInfo that come from a supplied alternate source. This object
        /// is ALWAYS read-only.
        /// Note that we really cannot use an LCID version of this override as the cached
        /// name we create for it has to include both names, and the logic for this is in
        /// the GetCultureInfo override *only*.
        /// </summary>
        internal CultureInfo(string cultureName, string textAndCompareCultureName)
        {
            ArgumentNullException.ThrowIfNull(textAndCompareCultureName);

            CultureData?cultureData = CultureData.GetCultureData(cultureName, false) ??
                                      throw new CultureNotFoundException(nameof(cultureName), cultureName, GetCultureNotSupportedExceptionMessage());

            _cultureData = cultureData;

            _name = _cultureData.CultureName;

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);

            _compareInfo = altCulture.CompareInfo;
            _textInfo    = altCulture.TextInfo;
        }
Beispiel #2
0
        /// <summary>
        /// Constructor called by SQL Server's special munged culture - creates a culture with
        /// a TextInfo and CompareInfo that come from a supplied alternate source. This object
        /// is ALWAYS read-only.
        /// Note that we really cannot use an LCID version of this override as the cached
        /// name we create for it has to include both names, and the logic for this is in
        /// the GetCultureInfo override *only*.
        /// </summary>
        internal CultureInfo(string cultureName, string textAndCompareCultureName)
        {
            if (cultureName == null)
            {
                throw new ArgumentNullException(nameof(cultureName), SR.ArgumentNull_String);
            }

            CultureData?cultureData = CultureData.GetCultureData(cultureName, false) ??
                                      throw new CultureNotFoundException(nameof(cultureName), cultureName, SR.Argument_CultureNotSupported);

            _cultureData = cultureData;

            _name = _cultureData.CultureName;

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);

            _compareInfo = altCulture.CompareInfo;
            _textInfo    = altCulture.TextInfo;
        }