MemberAccessException.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. // MemberAccessException
  6. // Thrown when we try accessing a member that we cannot
  7. // access, due to it being removed, private or something similar.
  8. ////////////////////////////////////////////////////////////////////////////////
  9. using System.Runtime.Serialization;
  10. namespace System
  11. {
  12. // The MemberAccessException is thrown when trying to access a class
  13. // member fails.
  14. [Serializable]
  15. [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
  16. public class MemberAccessException : SystemException
  17. {
  18. // Creates a new MemberAccessException with its message string set to
  19. // the empty string, its HRESULT set to COR_E_MEMBERACCESS,
  20. // and its ExceptionInfo reference set to null.
  21. public MemberAccessException()
  22. : base(SR.Arg_AccessException)
  23. {
  24. HResult = HResults.COR_E_MEMBERACCESS;
  25. }
  26. // Creates a new MemberAccessException with its message string set to
  27. // message, its HRESULT set to COR_E_ACCESS,
  28. // and its ExceptionInfo reference set to null.
  29. //
  30. public MemberAccessException(string message)
  31. : base(message)
  32. {
  33. HResult = HResults.COR_E_MEMBERACCESS;
  34. }
  35. public MemberAccessException(string message, Exception inner)
  36. : base(message, inner)
  37. {
  38. HResult = HResults.COR_E_MEMBERACCESS;
  39. }
  40. protected MemberAccessException(SerializationInfo info, StreamingContext context) : base(info, context)
  41. {
  42. }
  43. }
  44. }