diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2016-12-27 16:46:08 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2016-12-27 16:46:08 +0900 |
commit | db20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch) | |
tree | e5435159cd1bf0519276363a6fe1663d1721bed3 /src/mscorlib/src/System/Globalization/NumberFormatInfo.cs | |
parent | 4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff) | |
download | coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2 coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip |
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'src/mscorlib/src/System/Globalization/NumberFormatInfo.cs')
-rw-r--r-- | src/mscorlib/src/System/Globalization/NumberFormatInfo.cs | 66 |
1 files changed, 22 insertions, 44 deletions
diff --git a/src/mscorlib/src/System/Globalization/NumberFormatInfo.cs b/src/mscorlib/src/System/Globalization/NumberFormatInfo.cs index fae91c2a1d..a5dce46aa4 100644 --- a/src/mscorlib/src/System/Globalization/NumberFormatInfo.cs +++ b/src/mscorlib/src/System/Globalization/NumberFormatInfo.cs @@ -120,28 +120,8 @@ namespace System.Globalization { [OnSerializing] private void OnSerializing(StreamingContext ctx) { -#if !FEATURE_CORECLR - // Update these legacy flags, so that 1.1/2.0 versions of the framework - // can still throw while parsing; even when using a de-serialized - // NumberFormatInfo from a 4.0+ version of the framework - if (numberDecimalSeparator != numberGroupSeparator) { - validForParseAsNumber = true; - } else { - validForParseAsNumber = false; - } - - if ((numberDecimalSeparator != numberGroupSeparator) && - (numberDecimalSeparator != currencyGroupSeparator) && - (currencyDecimalSeparator != numberGroupSeparator) && - (currencyDecimalSeparator != currencyGroupSeparator)) { - validForParseAsCurrency = true; - } else { - validForParseAsCurrency = false; - } -#endif // !FEATURE_CORECLR } - [OnDeserializing] private void OnDeserializing(StreamingContext ctx) { @@ -153,7 +133,6 @@ namespace System.Globalization { } #endregion Serialization - static private void VerifyDecimalSeparator(String decSep, String propertyName) { if (decSep==null) { throw new ArgumentNullException(propertyName, @@ -231,7 +210,6 @@ namespace System.Globalization { // We aren't persisting dataItem any more (since its useless & we weren't using it), // Ditto with m_useUserOverride. Don't use them, we use a local copy of everything. - [System.Security.SecuritySafeCritical] // auto-generated internal NumberFormatInfo(CultureData cultureData) { if (cultureData != null) @@ -316,7 +294,7 @@ namespace System.Globalization { set { if (value < 0 || value > 99) { throw new ArgumentOutOfRangeException( - "CurrencyDecimalDigits", + nameof(CurrencyDecimalDigits), String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), @@ -376,7 +354,7 @@ namespace System.Globalization { } set { if (value == null) { - throw new ArgumentNullException("CurrencyGroupSizes", + throw new ArgumentNullException(nameof(CurrencyGroupSizes), Environment.GetResourceString("ArgumentNull_Obj")); } Contract.EndContractBlock(); @@ -397,7 +375,7 @@ namespace System.Globalization { } set { if (value == null) { - throw new ArgumentNullException("NumberGroupSizes", + throw new ArgumentNullException(nameof(NumberGroupSizes), Environment.GetResourceString("ArgumentNull_Obj")); } Contract.EndContractBlock(); @@ -416,7 +394,7 @@ namespace System.Globalization { } set { if (value == null) { - throw new ArgumentNullException("PercentGroupSizes", + throw new ArgumentNullException(nameof(PercentGroupSizes), Environment.GetResourceString("ArgumentNull_Obj")); } Contract.EndContractBlock(); @@ -443,7 +421,7 @@ namespace System.Globalization { get { return currencySymbol; } set { if (value == null) { - throw new ArgumentNullException("CurrencySymbol", + throw new ArgumentNullException(nameof(CurrencySymbol), Environment.GetResourceString("ArgumentNull_String")); } Contract.EndContractBlock(); @@ -475,7 +453,7 @@ namespace System.Globalization { } set { if (value == null) { - throw new ArgumentNullException("NaNSymbol", + throw new ArgumentNullException(nameof(NaNSymbol), Environment.GetResourceString("ArgumentNull_String")); } Contract.EndContractBlock(); @@ -491,7 +469,7 @@ namespace System.Globalization { set { if (value < 0 || value > 15) { throw new ArgumentOutOfRangeException( - "CurrencyNegativePattern", + nameof(CurrencyNegativePattern), String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), @@ -513,7 +491,7 @@ namespace System.Globalization { // if (value < 0 || value > 4) { throw new ArgumentOutOfRangeException( - "NumberNegativePattern", + nameof(NumberNegativePattern), String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), @@ -535,7 +513,7 @@ namespace System.Globalization { // if (value < 0 || value > 3) { throw new ArgumentOutOfRangeException( - "PercentPositivePattern", + nameof(PercentPositivePattern), String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), @@ -557,7 +535,7 @@ namespace System.Globalization { // if (value < 0 || value > 11) { throw new ArgumentOutOfRangeException( - "PercentNegativePattern", + nameof(PercentNegativePattern), String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), @@ -577,7 +555,7 @@ namespace System.Globalization { } set { if (value == null) { - throw new ArgumentNullException("NegativeInfinitySymbol", + throw new ArgumentNullException(nameof(NegativeInfinitySymbol), Environment.GetResourceString("ArgumentNull_String")); } Contract.EndContractBlock(); @@ -591,7 +569,7 @@ namespace System.Globalization { get { return negativeSign; } set { if (value == null) { - throw new ArgumentNullException("NegativeSign", + throw new ArgumentNullException(nameof(NegativeSign), Environment.GetResourceString("ArgumentNull_String")); } Contract.EndContractBlock(); @@ -606,7 +584,7 @@ namespace System.Globalization { set { if (value < 0 || value > 99) { throw new ArgumentOutOfRangeException( - "NumberDecimalDigits", + nameof(NumberDecimalDigits), String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), @@ -645,7 +623,7 @@ namespace System.Globalization { set { if (value < 0 || value > 3) { throw new ArgumentOutOfRangeException( - "CurrencyPositivePattern", + nameof(CurrencyPositivePattern), String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), @@ -665,7 +643,7 @@ namespace System.Globalization { } set { if (value == null) { - throw new ArgumentNullException("PositiveInfinitySymbol", + throw new ArgumentNullException(nameof(PositiveInfinitySymbol), Environment.GetResourceString("ArgumentNull_String")); } Contract.EndContractBlock(); @@ -679,7 +657,7 @@ namespace System.Globalization { get { return positiveSign; } set { if (value == null) { - throw new ArgumentNullException("PositiveSign", + throw new ArgumentNullException(nameof(PositiveSign), Environment.GetResourceString("ArgumentNull_String")); } Contract.EndContractBlock(); @@ -694,7 +672,7 @@ namespace System.Globalization { set { if (value < 0 || value > 99) { throw new ArgumentOutOfRangeException( - "PercentDecimalDigits", + nameof(PercentDecimalDigits), String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), @@ -734,7 +712,7 @@ namespace System.Globalization { } set { if (value == null) { - throw new ArgumentNullException("PercentSymbol", + throw new ArgumentNullException(nameof(PercentSymbol), Environment.GetResourceString("ArgumentNull_String")); } Contract.EndContractBlock(); @@ -748,7 +726,7 @@ namespace System.Globalization { get { return perMilleSymbol; } set { if (value == null) { - throw new ArgumentNullException("PerMilleSymbol", + throw new ArgumentNullException(nameof(PerMilleSymbol), Environment.GetResourceString("ArgumentNull_String")); } Contract.EndContractBlock(); @@ -788,7 +766,7 @@ namespace System.Globalization { public static NumberFormatInfo ReadOnly(NumberFormatInfo nfi) { if (nfi == null) { - throw new ArgumentNullException("nfi"); + throw new ArgumentNullException(nameof(nfi)); } Contract.EndContractBlock(); if (nfi.IsReadOnly) { @@ -809,7 +787,7 @@ namespace System.Globalization { internal static void ValidateParseStyleInteger(NumberStyles style) { // Check for undefined flags if ((style & InvalidNumberStyles) != 0) { - throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNumberStyles"), "style"); + throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNumberStyles"), nameof(style)); } Contract.EndContractBlock(); if ((style & NumberStyles.AllowHexSpecifier) != 0) { // Check for hex number @@ -822,7 +800,7 @@ namespace System.Globalization { internal static void ValidateParseStyleFloatingPoint(NumberStyles style) { // Check for undefined flags if ((style & InvalidNumberStyles) != 0) { - throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNumberStyles"), "style"); + throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNumberStyles"), nameof(style)); } Contract.EndContractBlock(); if ((style & NumberStyles.AllowHexSpecifier) != 0) { // Check for hex number |