diff options
Diffstat (limited to 'src/mscorlib/src/System/NotFiniteNumberException.cs')
-rw-r--r-- | src/mscorlib/src/System/NotFiniteNumberException.cs | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/src/mscorlib/src/System/NotFiniteNumberException.cs b/src/mscorlib/src/System/NotFiniteNumberException.cs index 3a896ce548..68e8f88d81 100644 --- a/src/mscorlib/src/System/NotFiniteNumberException.cs +++ b/src/mscorlib/src/System/NotFiniteNumberException.cs @@ -2,68 +2,70 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace System { - - using System; - using System.Runtime.Serialization; - using System.Security.Permissions; - using System.Diagnostics.Contracts; +using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +namespace System +{ [Serializable] - public class NotFiniteNumberException : ArithmeticException { + public class NotFiniteNumberException : ArithmeticException + { private double _offendingNumber; public NotFiniteNumberException() - : base(Environment.GetResourceString("Arg_NotFiniteNumberException")) { + : base(SR.Arg_NotFiniteNumberException) + { _offendingNumber = 0; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(double offendingNumber) - : base() { + : base() + { _offendingNumber = offendingNumber; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(String message) - : base(message) { + : base(message) + { _offendingNumber = 0; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(String message, double offendingNumber) - : base(message) { + : base(message) + { _offendingNumber = offendingNumber; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + : base(message, innerException) + { + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(String message, double offendingNumber, Exception innerException) - : base(message, innerException) { + : base(message, innerException) + { _offendingNumber = offendingNumber; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } - protected NotFiniteNumberException(SerializationInfo info, StreamingContext context) : base(info, context) { + protected NotFiniteNumberException(SerializationInfo info, StreamingContext context) : base(info, context) + { _offendingNumber = info.GetInt32("OffendingNumber"); } - public double OffendingNumber { - get { return _offendingNumber; } - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) { - if (info==null) { - throw new ArgumentNullException(nameof(info)); - } - Contract.EndContractBlock(); + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { base.GetObjectData(info, context); info.AddValue("OffendingNumber", _offendingNumber, typeof(Int32)); } + + public double OffendingNumber + { + get { return _offendingNumber; } + } } } |