ArithmeticException.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. /*=============================================================================
  5. **
  6. **
  7. **
  8. ** Purpose: Exception class for bad arithmetic conditions!
  9. **
  10. **
  11. =============================================================================*/
  12. using System.Runtime.Serialization;
  13. namespace System
  14. {
  15. // The ArithmeticException is thrown when overflow or underflow
  16. // occurs.
  17. [Serializable]
  18. [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
  19. public class ArithmeticException : SystemException
  20. {
  21. // Creates a new ArithmeticException with its message string set to
  22. // the empty string, its HRESULT set to COR_E_ARITHMETIC,
  23. // and its ExceptionInfo reference set to null.
  24. public ArithmeticException()
  25. : base(SR.Arg_ArithmeticException)
  26. {
  27. HResult = HResults.COR_E_ARITHMETIC;
  28. }
  29. // Creates a new ArithmeticException with its message string set to
  30. // message, its HRESULT set to COR_E_ARITHMETIC,
  31. // and its ExceptionInfo reference set to null.
  32. //
  33. public ArithmeticException(string message)
  34. : base(message)
  35. {
  36. HResult = HResults.COR_E_ARITHMETIC;
  37. }
  38. public ArithmeticException(string message, Exception innerException)
  39. : base(message, innerException)
  40. {
  41. HResult = HResults.COR_E_ARITHMETIC;
  42. }
  43. protected ArithmeticException(SerializationInfo info, StreamingContext context) : base(info, context)
  44. {
  45. }
  46. }
  47. }