Clone() public method

public Clone ( ) : object
return object
 internal static DateTimeFormatInfo GetDateFormatInternal(CultureInfo culture) {
     if (culture is PersianCultureInfo || culture.Calendar is PersianCalendar)
         return culture.DateTimeFormat;
     var foundCal = culture.OptionalCalendars.OfType<PersianCalendar>().FirstOrDefault();
     if (foundCal != null) {
         var dtfi = ((CultureInfo)culture.Clone()).DateTimeFormat;
         if (!dtfi.IsReadOnly)
             dtfi.Calendar = foundCal;
         return dtfi;
     }
     return GetDefaultDateFormat(culture);
 }
Example #2
0
 public void TestClone2()
 {
     CultureInfo myCultureInfo = new CultureInfo("en");
     CultureInfo myClone = myCultureInfo.Clone() as CultureInfo;
     Assert.True(myClone.Equals(myCultureInfo));
     Assert.NotSame(myClone, myCultureInfo);
 }
        public void PosTest2()
        {
            DateTimeFormatInfo expected = new CultureInfo("en-us").DateTimeFormat;
            VerificationHelper(expected, expected.Clone());

            expected = new CultureInfo("fr-FR").DateTimeFormat;
            VerificationHelper(expected, expected.Clone());
        }
 public CodeDomLocalizationProvider(IServiceProvider provider, CodeDomLocalizationModel model, CultureInfo[] supportedCultures)
 {
     if (provider == null)
     {
         throw new ArgumentNullException("provider");
     }
     if (supportedCultures == null)
     {
         throw new ArgumentNullException("supportedCultures");
     }
     this._model = model;
     this._supportedCultures = (CultureInfo[]) supportedCultures.Clone();
     this.Initialize(provider);
 }
        public void TestCachingWithClonedCulture()
        {
            var original = new CultureInfo("en-US");
            var clone = (CultureInfo) original.Clone();
            Assert.AreEqual(original.Name, clone.Name);
            clone.DateTimeFormat.DateSeparator = "@@@";

            // Fool Noda Time into believing both are read-only, so it can use a cache...
            original = CultureInfo.ReadOnly(original);
            clone = CultureInfo.ReadOnly(clone);

            var nodaOriginal = NodaFormatInfo.GetFormatInfo(original);
            var nodaClone = NodaFormatInfo.GetFormatInfo(clone);
            Assert.AreEqual(original.DateTimeFormat.DateSeparator, nodaOriginal.DateSeparator);
            Assert.AreEqual(clone.DateTimeFormat.DateSeparator, nodaClone.DateSeparator);
        }
        public void TestCachingWithClonedCulture()
        {
            var original = new CultureInfo("en-US");
            var clone = (CultureInfo) original.Clone();
            Assert.AreEqual(original.Name, clone.Name);
            var dayNames = clone.DateTimeFormat.DayNames;
            dayNames[1] = "@@@";
            clone.DateTimeFormat.DayNames = dayNames;

            // Fool Noda Time into believing both are read-only, so it can use a cache...
            original = CultureInfo.ReadOnly(original);
            clone = CultureInfo.ReadOnly(clone);

            var nodaOriginal = NodaFormatInfo.GetFormatInfo(original);
            var nodaClone = NodaFormatInfo.GetFormatInfo(clone);
            Assert.AreEqual(original.DateTimeFormat.DayNames[1], nodaOriginal.LongDayNames[1]);
            Assert.AreEqual(clone.DateTimeFormat.DayNames[1], nodaClone.LongDayNames[1]);
            // Just check we made a difference...
            Assert.AreNotEqual(nodaOriginal.LongDayNames[1], nodaClone.LongDayNames[1]);
        }
Example #7
0
		public static CultureInfo ReadOnly(CultureInfo ci)
		{
			if(ci==null) {
				throw new ArgumentNullException("ci");
			}

			if(ci.m_isReadOnly) {
				return(ci);
			} else {
				CultureInfo new_ci=(CultureInfo)ci.Clone ();
				new_ci.m_isReadOnly=true;
				if (new_ci.numInfo != null)
					new_ci.numInfo = NumberFormatInfo.ReadOnly (new_ci.numInfo);
				if (new_ci.dateTimeInfo != null)
					new_ci.dateTimeInfo = DateTimeFormatInfo.ReadOnly (new_ci.dateTimeInfo);
				if (new_ci.textInfo != null)
					new_ci.textInfo = TextInfo.ReadOnly (new_ci.textInfo);
				return(new_ci);
			}
		}
Example #8
0
		[Test] // bug #77347
		public void CloneNeutral ()
		{
			CultureInfo culture = new CultureInfo ("en");
			CultureInfo cultureClone = culture.Clone () as CultureInfo;
			Assert.IsTrue (culture.Equals (cultureClone));
		}
Example #9
0
 public void TestClone()
 {
     CultureInfo myCultureInfo = new CultureInfo("fr-FR");
     CultureInfo myClone = myCultureInfo.Clone() as CultureInfo;
     Assert.True(myClone.Equals(myCultureInfo));
 }
        /// <summary>
        /// Ripped straight from .Net FX.
        /// </summary>
        /// <param name="culture"></param>
        /// <returns></returns>
        internal static DateTimeFormatInfo GetDateFormat(CultureInfo culture)
        {
            if (culture.Calendar is GregorianCalendar)
            {
                return culture.DateTimeFormat;
            }
            else
            {
                GregorianCalendar foundCal = null;
                DateTimeFormatInfo dtfi = null;

                foreach (System.Globalization.Calendar cal in culture.OptionalCalendars)
                {
                    if (cal is GregorianCalendar)
                    {
                        // Return the first Gregorian calendar with CalendarType == Localized
                        // Otherwise return the first Gregorian calendar
                        if (foundCal == null)
                        {
                            foundCal = cal as GregorianCalendar;
                        }

                        if (((GregorianCalendar)cal).CalendarType == GregorianCalendarTypes.Localized)
                        {
                            foundCal = cal as GregorianCalendar;
                            break;
                        }
                    }
                }

                if (foundCal == null)
                {
                    // if there are no GregorianCalendars in the OptionalCalendars list, use the invariant dtfi
                    dtfi = ((CultureInfo)CultureInfo.InvariantCulture.Clone()).DateTimeFormat;
                    dtfi.Calendar = new GregorianCalendar();
                }
                else
                {
                    dtfi = ((CultureInfo)culture.Clone()).DateTimeFormat;
                    dtfi.Calendar = foundCal;
                }

                return dtfi;
            }
        }
Example #11
0
	public void Clone ()
	{
		TextInfo enus = new CultureInfo ("en-US").TextInfo;
		TextInfo clone = (TextInfo) enus.Clone ();
		CompareProperties (enus, clone, true);
	}
Example #12
0
		public static CultureInfo ReadOnly(CultureInfo ci)
		{
			if(ci==null) {
				throw new ArgumentNullException("ci");
			}

			if(ci.m_isReadOnly) {
				return(ci);
			} else {
				CultureInfo new_ci=(CultureInfo)ci.Clone ();
				new_ci.m_isReadOnly=true;
				if (new_ci.numInfo != null)
					new_ci.numInfo = NumberFormatInfo.ReadOnly (new_ci.numInfo);
				if (new_ci.dateTimeInfo != null)
					new_ci.dateTimeInfo = DateTimeFormatInfo.ReadOnly (new_ci.dateTimeInfo);
#if NET_2_0
				// TextInfo doesn't have a ReadOnly method in 1.1...
				if (new_ci.textInfo != null)
					new_ci.textInfo = TextInfo.ReadOnly (new_ci.textInfo);
#endif
				return(new_ci);
			}
		}
Example #13
0
        // Create a modifiable culture with the same properties as the specified number culture,
        // but with digits '0' through '9' starting at the specified unicode value.
        private CultureInfo CreateTraditionalCulture(CultureInfo numberCulture, int firstDigit, bool arabic)
        {
            // Create the digit culture by cloning the given number culture. According to MSDN, 
            // "CultureInfo.Clone is a shallow copy with exceptions. The objects returned by 
            // the NumberFormat and the DateTimeFormat properties are also cloned, so that the 
            // CultureInfo clone can modify the properties of NumberFormat and DateTimeFormat 
            // without affecting the original CultureInfo."
            CultureInfo digitCulture = (CultureInfo)numberCulture.Clone();

            // Create the array of digits.
            string[] digits = new string[10];

            if (firstDigit < 0x10000)
            {
                for (int i = 0; i < 10; ++i)
                {
                    digits[i] = new string((char)(firstDigit + i), 1);
                }
            }
            else
            {
                for (int i = 0; i < 10; ++i)
                {
                    int n = firstDigit + i - 0x10000;

                    digits[i] = new string(
                        new char[] {
                            (char)((n >> 10) | 0xD800),     // high surrogate
                            (char)((n & 0x03FF) | 0xDC00)   // low surrogate
                            }
                        );
                }
            }

            // Set the digits.
            digitCulture.NumberFormat.NativeDigits = digits;

            if (arabic)
            {
                digitCulture.NumberFormat.PercentSymbol = "\u066a";
                digitCulture.NumberFormat.NumberDecimalSeparator = "\u066b";
                digitCulture.NumberFormat.NumberGroupSeparator = "\u066c";
            }
            else
            {
                digitCulture.NumberFormat.PercentSymbol = "%";
                digitCulture.NumberFormat.NumberDecimalSeparator = ".";
                digitCulture.NumberFormat.NumberGroupSeparator = ",";
            }

            return digitCulture;
        }
        // Display accounts, transactions, and statements for customer
        //   with input first name & last name
        //  (there may be more than one customer with the same first name and last name)
        // Return true if customer was found in DB, otherwise return false
        public static bool displayBankData(string custFirstName, string custLastName)
        {
            const string LINESEPARATOR = "--------------------------------------------------------";
            const string CURRENTCULTURE = "en-us"; // for formatting negative currency values

            using (var db = new LargeBankEntities())
            {
                // Get customer data (return if customer was not found)
                var customerList = db.Customers.Where(c => c.FirstName == custFirstName &&
                                                    c.LastName == custLastName);

                if (customerList.Count() == 0)
                {
                    return false;
                }

                // Print data for each customer that was found in the DB
                foreach (var customer in customerList)
                {
                    // Print the customer data
                    Console.WriteLine(LINESEPARATOR);
                    Console.WriteLine("Customer: {0} {1} joined LargeBank on: {2}",
                        customer.FirstName, customer.LastName, customer.CreatedDate.ToShortDateString());
                    Console.WriteLine("Address: \n" + customer.Address1);
                    if (customer.Address2 != null)
                    {
                        Console.WriteLine(customer.Address2);
                    }
                    Console.Write(customer.City + ", " + customer.State);
                    if (customer.Zip == null)
                    {
                        Console.WriteLine("");
                    }
                    else
                    {
                        Console.WriteLine(" " + customer.Zip);
                    }

                    // Set number format info to use negative sign instead of parentheses
                    //  for negative numbers in the transaction data
                    var originalCultureInfo = new CultureInfo(CURRENTCULTURE);
                    var modifiedCultureInfo = (CultureInfo)originalCultureInfo.Clone();
                    modifiedCultureInfo.NumberFormat.CurrencyNegativePattern = 1;

                    // Print data for each account belonging to the customer
                    foreach (var account in customer.Accounts)
                    {
                        Console.WriteLine(LINESEPARATOR);
                        Console.WriteLine("--Balance for account# " + account.AccountNumber +
                                " is: " + account.Balance.ToString("C"));

                        // Print the transaction data for the account
                        foreach (var transaction in account.Transactions)
                        {
                            Console.WriteLine("---Transaction date: {0}, amount: {1}",
                                   transaction.TransactionDate.ToShortDateString(),
                                   string.Format(modifiedCultureInfo, "{0:C}", transaction.Amount));
                        }

                        // Print the statement data for the account
                        foreach (var statement in account.Statements)
                        {
                            Console.WriteLine("---Statement start date: {0}, end date: {1}",
                                   statement.StartDate.ToShortDateString(),
                                    statement.EndDate.ToShortDateString());
                            if (statement.CreatedDate != null)
                            {
                                Console.WriteLine("----Created on: ",
                                    statement.CreatedDate.Value.ToShortDateString());
                            }
                        }
                    }
                    Console.WriteLine(LINESEPARATOR + "\n");
                }
            }
            return true;
        }
		public CultureInfo GetCultureInfo(string name) {
			if(name == null) {
				throw new ArgumentNullException("name");
			}
			CultureInfo cultureInfo = null;
			if(cultureInfoCache.ContainsKey(name)) {
				cultureInfo = cultureInfoCache[name];
			}
			if(cultureInfo != null)
				return (CultureInfo)cultureInfo.Clone();

			cultureInfo = new CultureInfo(name);

			var config = ConfigRepository.Instance.GetConfig(ConfigRepository.Instance.SystemConfigKey, true);
			if(config == null) {
				return cultureInfo;
			}

			string dateTimeFormatConfigKey = string.Format("cultureConfig/culture[@value=\"{0}\"]/dateTimeFormat", name);
			if(config.ContainsKey(dateTimeFormatConfigKey)) {
				IConfig dateTimeFormatConfig = config.GetConfigSection(dateTimeFormatConfigKey);

				string[] abbreviatedMonthGenitiveNames = dateTimeFormatConfig.GetValueArray("abbreviatedMonthGenitiveNames", "abbreviatedMonthGenitiveName");
				if(abbreviatedMonthGenitiveNames.Length > 0) {
					try {
						cultureInfo.DateTimeFormat.AbbreviatedMonthGenitiveNames = abbreviatedMonthGenitiveNames;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/abbreviatedMonthGenitiveNames] {1}", dateTimeFormatConfigKey, ex.Message));
					}
				}

				string[] monthGenitiveNames = dateTimeFormatConfig.GetValueArray("monthGenitiveNames", "monthGenitiveName");
				if(monthGenitiveNames.Length > 0) {
					try {
						cultureInfo.DateTimeFormat.MonthGenitiveNames = monthGenitiveNames;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/monthGenitiveNames] {1}", dateTimeFormatConfigKey, ex.Message));
					}
				}

				string[] abbreviatedDayNames = dateTimeFormatConfig.GetValueArray("abbreviatedDayNames", "abbreviatedDayName");
				if(abbreviatedDayNames.Length > 0) {
					try {
						cultureInfo.DateTimeFormat.AbbreviatedDayNames = abbreviatedDayNames;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/abbreviatedDayNames] {1}", dateTimeFormatConfigKey, ex.Message));
					}
				}

				string[] shortestDayNames = dateTimeFormatConfig.GetValueArray("shortestDayNames", "shortestDayName");
				if(shortestDayNames.Length > 0) {
					try {
						cultureInfo.DateTimeFormat.ShortestDayNames = shortestDayNames;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/shortestDayNames] {1}", dateTimeFormatConfigKey, ex.Message));
					}
				}

				string[] abbreviatedMonthNames = dateTimeFormatConfig.GetValueArray("abbreviatedMonthNames", "abbreviatedMonthName");
				if(abbreviatedMonthNames.Length > 0) {
					try {
						cultureInfo.DateTimeFormat.AbbreviatedMonthNames = abbreviatedMonthNames;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/abbreviatedMonthNames] {1}", dateTimeFormatConfigKey, ex.Message));
					}
				}

				string[] dayNames = dateTimeFormatConfig.GetValueArray("dayNames", "dayName");
				if(dayNames.Length > 0) {
					try {
						cultureInfo.DateTimeFormat.DayNames = dayNames;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/dayNames] {1}", dateTimeFormatConfigKey, ex.Message));
					}
				}


				string[] monthNames = dateTimeFormatConfig.GetValueArray("monthNames", "monthName");
				if(monthNames.Length > 0) {
					try {
						cultureInfo.DateTimeFormat.MonthNames = monthNames;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/monthNames] {1}", dateTimeFormatConfigKey, ex.Message));
					}
				}

				if(dateTimeFormatConfig.ContainsKey("calendarWeekRule")) {
					try {
						cultureInfo.DateTimeFormat.CalendarWeekRule = (CalendarWeekRule)Enum.Parse(typeof(CalendarWeekRule), dateTimeFormatConfig.GetValue("calendarWeekRule"), true);
					} catch(ArgumentException) {
						throw new ConfigurationException(string.Format("Value [{0}/calendarWeekRule] is not of type CalendarWeekRule", dateTimeFormatConfigKey));
					}
				}

				if(dateTimeFormatConfig.ContainsKey("firstDayOfWeek")) {
					try {
						cultureInfo.DateTimeFormat.FirstDayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), dateTimeFormatConfig.GetValue("firstDayOfWeek"), true);
					} catch(ArgumentException) {
						throw new ConfigurationException(string.Format("Value [{0}/firstDayOfWeek] is not of type DayOfWeek", dateTimeFormatConfigKey));
					}
				}

				if(dateTimeFormatConfig.ContainsKey("amDesignator")) {
					cultureInfo.DateTimeFormat.AMDesignator = dateTimeFormatConfig.GetValue("amDesignator");
				}

				if(dateTimeFormatConfig.ContainsKey("pmDesignator")) {
					cultureInfo.DateTimeFormat.PMDesignator = dateTimeFormatConfig.GetValue("pmDesignator");
				}

				if(dateTimeFormatConfig.ContainsKey("dateSeparator")) {
					cultureInfo.DateTimeFormat.DateSeparator = dateTimeFormatConfig.GetValue("dateSeparator");
				}

				if(dateTimeFormatConfig.ContainsKey("fullDateTimePattern")) {
					cultureInfo.DateTimeFormat.FullDateTimePattern = dateTimeFormatConfig.GetValue("fullDateTimePattern");
				}

				if(dateTimeFormatConfig.ContainsKey("longDatePattern")) {
					cultureInfo.DateTimeFormat.LongDatePattern = dateTimeFormatConfig.GetValue("longDatePattern");
				}

				if(dateTimeFormatConfig.ContainsKey("longTimePattern")) {
					cultureInfo.DateTimeFormat.LongTimePattern = dateTimeFormatConfig.GetValue("longTimePattern");
				}

				if(dateTimeFormatConfig.ContainsKey("monthDayPattern")) {
					cultureInfo.DateTimeFormat.MonthDayPattern = dateTimeFormatConfig.GetValue("monthDayPattern");
				}

				if(dateTimeFormatConfig.ContainsKey("shortDatePattern")) {
					cultureInfo.DateTimeFormat.ShortDatePattern = dateTimeFormatConfig.GetValue("shortDatePattern");
				}

				if(dateTimeFormatConfig.ContainsKey("shortTimePattern")) {
					cultureInfo.DateTimeFormat.ShortTimePattern = dateTimeFormatConfig.GetValue("shortTimePattern");
				}

				if(dateTimeFormatConfig.ContainsKey("timeSeparator")) {
					cultureInfo.DateTimeFormat.TimeSeparator = dateTimeFormatConfig.GetValue("timeSeparator");
				}

				if(dateTimeFormatConfig.ContainsKey("yearMonthPattern")) {
					cultureInfo.DateTimeFormat.YearMonthPattern = dateTimeFormatConfig.GetValue("yearMonthPattern");
				}

			}

			string numberFormatConfigKey = string.Format("cultureConfig/culture[@value=\"{0}\"]/numberFormat", name);

			if(config.ContainsKey(numberFormatConfigKey)) {
				IConfig numberFormatConfig = config.GetConfigSection(numberFormatConfigKey);

				if(numberFormatConfig.ContainsKey("currencyDecimalDigits")) {
					cultureInfo.NumberFormat.CurrencyDecimalDigits = numberFormatConfig.GetValue<int>("currencyDecimalDigits");
				}

				if(numberFormatConfig.ContainsKey("currencyNegativePattern")) {
					cultureInfo.NumberFormat.CurrencyNegativePattern = numberFormatConfig.GetValue<int>("currencyNegativePattern");
				}

				if(numberFormatConfig.ContainsKey("currencyPositivePattern")) {
					cultureInfo.NumberFormat.CurrencyPositivePattern = numberFormatConfig.GetValue<int>("currencyPositivePattern");
				}

				if(numberFormatConfig.ContainsKey("numberDecimalDigits")) {
					cultureInfo.NumberFormat.NumberDecimalDigits = numberFormatConfig.GetValue<int>("numberDecimalDigits");
				}

				if(numberFormatConfig.ContainsKey("numberNegativePattern")) {
					cultureInfo.NumberFormat.NumberNegativePattern = numberFormatConfig.GetValue<int>("numberNegativePattern");
				}

				if(numberFormatConfig.ContainsKey("percentDecimalDigits")) {
					cultureInfo.NumberFormat.PercentDecimalDigits = numberFormatConfig.GetValue<int>("percentDecimalDigits");
				}

				if(numberFormatConfig.ContainsKey("percentNegativePattern")) {
					cultureInfo.NumberFormat.PercentNegativePattern = numberFormatConfig.GetValue<int>("percentNegativePattern");
				}

				if(numberFormatConfig.ContainsKey("percentPositivePattern")) {
					cultureInfo.NumberFormat.PercentPositivePattern = numberFormatConfig.GetValue<int>("percentPositivePattern");
				}

				if(numberFormatConfig.ContainsKey("currencyDecimalSeparator")) {
					cultureInfo.NumberFormat.CurrencyDecimalSeparator = numberFormatConfig.GetValue("currencyDecimalSeparator");
				}

				if(numberFormatConfig.ContainsKey("currencyGroupSeparator")) {
					cultureInfo.NumberFormat.CurrencyGroupSeparator = numberFormatConfig.GetValue("currencyGroupSeparator");
				}

				if(numberFormatConfig.ContainsKey("currencySymbol")) {
					cultureInfo.NumberFormat.CurrencySymbol = numberFormatConfig.GetValue("currencySymbol");
				}

				if(numberFormatConfig.ContainsKey("nanSymbol")) {
					cultureInfo.NumberFormat.NaNSymbol = numberFormatConfig.GetValue("nanSymbol");
				}

				if(numberFormatConfig.ContainsKey("negativeInfinitySymbol")) {
					cultureInfo.NumberFormat.NegativeInfinitySymbol = numberFormatConfig.GetValue("negativeInfinitySymbol");
				}

				if(numberFormatConfig.ContainsKey("negativeSign")) {
					cultureInfo.NumberFormat.NegativeSign = numberFormatConfig.GetValue("negativeSign");
				}

				if(numberFormatConfig.ContainsKey("numberDecimalSeparator")) {
					cultureInfo.NumberFormat.NumberDecimalSeparator = numberFormatConfig.GetValue("numberDecimalSeparator");
				}

				if(numberFormatConfig.ContainsKey("numberGroupSeparator")) {
					cultureInfo.NumberFormat.NumberGroupSeparator = numberFormatConfig.GetValue("numberGroupSeparator");
				}

				if(numberFormatConfig.ContainsKey("percentDecimalSeparator")) {
					cultureInfo.NumberFormat.PercentDecimalSeparator = numberFormatConfig.GetValue("percentDecimalSeparator");
				}

				if(numberFormatConfig.ContainsKey("percentGroupSeparator")) {
					cultureInfo.NumberFormat.PercentGroupSeparator = numberFormatConfig.GetValue("percentGroupSeparator");
				}

				if(numberFormatConfig.ContainsKey("percentSymbol")) {
					cultureInfo.NumberFormat.PercentSymbol = numberFormatConfig.GetValue("percentSymbol");
				}

				if(numberFormatConfig.ContainsKey("perMilleSymbol")) {
					cultureInfo.NumberFormat.PerMilleSymbol = numberFormatConfig.GetValue("perMilleSymbol");
				}

				if(numberFormatConfig.ContainsKey("positiveInfinitySymbol")) {
					cultureInfo.NumberFormat.PositiveInfinitySymbol = numberFormatConfig.GetValue("positiveInfinitySymbol");
				}

				if(numberFormatConfig.ContainsKey("positiveSign")) {
					cultureInfo.NumberFormat.PositiveSign = numberFormatConfig.GetValue("positiveSign");
				}

				int[] percentGroupSizes = numberFormatConfig.GetValueArray<int>("percentGroupSizes", "percentGroupSize");
				if(percentGroupSizes.Length > 0) {
					try {
						cultureInfo.NumberFormat.PercentGroupSizes = percentGroupSizes;
					} catch(ArgumentException ex) {
						throw new ConfigurationException("[" + numberFormatConfigKey + "/percentGroupSizes] " + ex.Message);
					}
				}

				int[] numberGroupSizes = numberFormatConfig.GetValueArray<int>("numberGroupSizes", "numberGroupSize");
				if(numberGroupSizes.Length > 0) {
					try {
						cultureInfo.NumberFormat.NumberGroupSizes = numberGroupSizes;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/numberGroupSizes] {1}", numberFormatConfigKey, ex.Message));
					}
				}

				int[] currencyGroupSizes = numberFormatConfig.GetValueArray<int>("currencyGroupSizes", "currencyGroupSize");
				if(currencyGroupSizes.Length > 0) {
					try {
						cultureInfo.NumberFormat.CurrencyGroupSizes = currencyGroupSizes;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/currencyGroupSizes] {1}", numberFormatConfigKey, ex.Message));
					}
				}

				if(numberFormatConfig.ContainsKey("digitSubstitution")) {
					try {
						cultureInfo.NumberFormat.DigitSubstitution = (DigitShapes)Enum.Parse(typeof(DigitShapes), numberFormatConfig.GetValue("digitSubstitution"), true);
					} catch(ArgumentException) {
						throw new ConfigurationException(string.Format("Value [{0}/digitSubstitution] is not of type DigitShapes", numberFormatConfigKey));
					}
				}

				string[] nativeDigits = numberFormatConfig.GetValueArray("nativeDigits", "nativeDigit");
				if(nativeDigits.Length > 0) {
					try {
						cultureInfo.NumberFormat.NativeDigits = nativeDigits;
					} catch(ArgumentException ex) {
						throw new ConfigurationException(string.Format("[{0}/nativeDigits] {1}", numberFormatConfigKey, ex.Message));
					}
				}
			}

			cultureInfoCache[name] = cultureInfo;

			return (CultureInfo)cultureInfo.Clone();
		}