UnauthorizedAccessException.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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: An exception for OS 'access denied' types of
  9. ** errors, including IO and limited security types
  10. ** of errors.
  11. **
  12. **
  13. ===========================================================*/
  14. using System.Runtime.Serialization;
  15. namespace System
  16. {
  17. // The UnauthorizedAccessException is thrown when access errors
  18. // occur from IO or other OS methods.
  19. [Serializable]
  20. [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
  21. public class UnauthorizedAccessException : SystemException
  22. {
  23. public UnauthorizedAccessException()
  24. : base(SR.Arg_UnauthorizedAccessException)
  25. {
  26. HResult = HResults.COR_E_UNAUTHORIZEDACCESS;
  27. }
  28. public UnauthorizedAccessException(string message)
  29. : base(message)
  30. {
  31. HResult = HResults.COR_E_UNAUTHORIZEDACCESS;
  32. }
  33. public UnauthorizedAccessException(string message, Exception inner)
  34. : base(message, inner)
  35. {
  36. HResult = HResults.COR_E_UNAUTHORIZEDACCESS;
  37. }
  38. protected UnauthorizedAccessException(SerializationInfo info, StreamingContext context) : base(info, context)
  39. {
  40. }
  41. }
  42. }