예제 #1
0
        /// <include file='doc\CultureInfo.uex' path='docs/doc[@for="CultureInfo.CultureInfo1"]/*' />
        public CultureInfo(String name, bool useUserOverride)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name",
                                                Environment.GetResourceString("ArgumentNull_String"));
            }

            this.m_dataItem = CultureTable.GetDataItemFromName(name);
            if (m_dataItem < 0)
            {
                throw new ArgumentException(
                          String.Format(Environment.GetResourceString("Argument_InvalidCultureName"), name), "name");
            }
            this.m_useUserOverride = useUserOverride;

            this.cultureID = CultureTable.GetDefaultInt32Value(m_dataItem, CultureTable.ILANGUAGE);
        }
예제 #2
0
        /*=================================GetCompareInfo==========================
         **Action: Get the CompareInfo for the specified culture.
         **Returns: The CompareInfo for the specified culture.
         **Arguments:
         **   name    the name of the culture.
         **Exceptions:
         **  ArgumentException if name is invalid.
         **============================================================================*/
        /// <include file='doc\CompareInfo.uex' path='docs/doc[@for="CompareInfo.GetCompareInfo3"]/*' />
        public static CompareInfo GetCompareInfo(String name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            int dataItem = CultureTable.GetDataItemFromName(name);

            if (dataItem == -1)
            {
                throw new ArgumentException(
                          String.Format(Environment.GetResourceString("Argument_InvalidCultureName"), name), "name");
            }

            int culture = CultureTable.GetDefaultInt32Value(dataItem, CultureTable.WIN32LANGID);

            return(GetCompareInfo(culture));
        }
예제 #3
0
        /*=================================GetCompareInfo==========================
         **Action: Get the CompareInfo constructed from the data table in the specified assembly for the specified culture.
         **       The purpose of this method is to provide version for CompareInfo tables.
         **Returns: The CompareInfo for the specified culture.
         **Arguments:
         **   name    the name of the culture
         **   assembly   the assembly which contains the sorting table.
         **Exceptions:
         **  ArugmentNullException when the assembly is null
         **  ArgumentException if name is invalid.
         **============================================================================*/
        /// <include file='doc\CompareInfo.uex' path='docs/doc[@for="CompareInfo.GetCompareInfo1"]/*' />
        public static CompareInfo GetCompareInfo(String name, Assembly assembly)
        {
            if (name == null || assembly == null)
            {
                throw new ArgumentNullException(name == null ? "name" : "assembly");
            }

            if (assembly != typeof(Object).Module.Assembly)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_OnlyMscorlib"));
            }

            int dataItem = CultureTable.GetDataItemFromName(name);

            if (dataItem == -1)
            {
                throw new ArgumentException(
                          String.Format(Environment.GetResourceString("Argument_InvalidCultureName"), name), "name");
            }

            int culture = CultureTable.GetDefaultInt32Value(dataItem, CultureTable.WIN32LANGID);

            return(GetCompareInfo(culture, assembly));
        }