The Labs \ Source Viewer \ SSCLI \ System \ NotFiniteNumberException

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. namespace System
  16. {
  17.    
  18.     using System;
  19.     using System.Runtime.Serialization;
  20.     using System.Security.Permissions;
  21.    
  22.     [System.Runtime.InteropServices.ComVisible(true)]
  23.     [Serializable()]
  24.     public class NotFiniteNumberException : ArithmeticException
  25.     {
  26.         private double _offendingNumber;
  27.        
  28.         public NotFiniteNumberException() : base(Environment.GetResourceString("Arg_NotFiniteNumberException"))
  29.         {
  30.             _offendingNumber = 0;
  31.             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
  32.         }
  33.        
  34.         public NotFiniteNumberException(double offendingNumber) : base()
  35.         {
  36.             _offendingNumber = offendingNumber;
  37.             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
  38.         }
  39.        
  40.         public NotFiniteNumberException(string message) : base(message)
  41.         {
  42.             _offendingNumber = 0;
  43.             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
  44.         }
  45.        
  46.         public NotFiniteNumberException(string message, double offendingNumber) : base(message)
  47.         {
  48.             _offendingNumber = offendingNumber;
  49.             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
  50.         }
  51.        
  52.         public NotFiniteNumberException(string message, Exception innerException) : base(message, innerException)
  53.         {
  54.             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
  55.         }
  56.        
  57.         public NotFiniteNumberException(string message, double offendingNumber, Exception innerException) : base(message, innerException)
  58.         {
  59.             _offendingNumber = offendingNumber;
  60.             SetErrorCode(__HResults.COR_E_NOTFINITENUMBER);
  61.         }
  62.        
  63.         protected NotFiniteNumberException(SerializationInfo info, StreamingContext context) : base(info, context)
  64.         {
  65.             _offendingNumber = info.GetInt32("OffendingNumber");
  66.         }
  67.        
  68.         public double OffendingNumber {
  69.             get { return _offendingNumber; }
  70.         }
  71.        
  72.         [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
  73.         public override void GetObjectData(SerializationInfo info, StreamingContext context)
  74.         {
  75.             if (info == null) {
  76.                 throw new ArgumentNullException("info");
  77.             }
  78.             base.GetObjectData(info, context);
  79.             info.AddValue("OffendingNumber", _offendingNumber, typeof(Int32));
  80.         }
  81.     }
  82. }

Developer Fusion