OutOfMemoryException.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. using System.Runtime.Serialization;
  5. namespace System
  6. {
  7. /// <summary>
  8. /// The exception class for OOM.
  9. /// </summary>
  10. [Serializable]
  11. [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
  12. public class OutOfMemoryException : SystemException
  13. {
  14. public OutOfMemoryException() : base(
  15. #if CORECLR
  16. GetMessageFromNativeResources(ExceptionMessageKind.OutOfMemory)
  17. #else
  18. SR.Arg_OutOfMemoryException
  19. #endif
  20. )
  21. {
  22. HResult = HResults.COR_E_OUTOFMEMORY;
  23. }
  24. public OutOfMemoryException(string message)
  25. : base(message)
  26. {
  27. HResult = HResults.COR_E_OUTOFMEMORY;
  28. }
  29. public OutOfMemoryException(string message, Exception innerException)
  30. : base(message, innerException)
  31. {
  32. HResult = HResults.COR_E_OUTOFMEMORY;
  33. }
  34. protected OutOfMemoryException(SerializationInfo info, StreamingContext context) : base(info, context)
  35. {
  36. }
  37. }
  38. }