EventInfo.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // System.Reflection/EventInfo.cs
  3. //
  4. // Author:
  5. // Paolo Molaro ([email protected])
  6. //
  7. // (C) 2001 Ximian, Inc. http://www.ximian.com
  8. //
  9. using System;
  10. using System.Reflection;
  11. namespace System.Reflection {
  12. public abstract class EventInfo : MemberInfo {
  13. public abstract EventAttributes Attributes {get;}
  14. public Type EventHandlerType {
  15. get {
  16. ParameterInfo[] p;
  17. MethodInfo add = GetAddMethod (true);
  18. p = add.GetParameters ();
  19. if (p.Length > 0) {
  20. Type t = p [0].ParameterType;
  21. /* is it alwasys the first arg?
  22. if (!t.IsSubclassOf (typeof (System.Delegate)))
  23. throw new Exception ("no delegate in event");*/
  24. return t;
  25. } else
  26. return null;
  27. }
  28. }
  29. public bool IsMulticast {get {return true;}}
  30. public bool IsSpecialName {get {return false;}}
  31. public override MemberTypes MemberType {
  32. get {return MemberTypes.Event;}
  33. }
  34. protected EventInfo() {
  35. }
  36. public void AddEventHandler( object target, Delegate handler) {
  37. }
  38. public MethodInfo GetAddMethod() {
  39. return GetAddMethod (false);
  40. }
  41. public abstract MethodInfo GetAddMethod(bool nonPublic);
  42. public MethodInfo GetRaiseMethod() {
  43. return GetRaiseMethod (false);
  44. }
  45. public abstract MethodInfo GetRaiseMethod( bool nonPublic);
  46. public MethodInfo GetRemoveMethod() {
  47. return GetRemoveMethod (false);
  48. }
  49. public abstract MethodInfo GetRemoveMethod( bool nonPublic);
  50. public void RemoveEventHandler( object target, Delegate handler) {
  51. }
  52. public override bool IsDefined (Type attributeType, bool inherit) {
  53. return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
  54. }
  55. public override object[] GetCustomAttributes( bool inherit) {
  56. return MonoCustomAttrs.GetCustomAttributes (this, inherit);
  57. }
  58. public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
  59. return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
  60. }
  61. public override Type ReflectedType {
  62. get {
  63. return null;
  64. }
  65. }
  66. public override Type DeclaringType {
  67. get {
  68. return null;
  69. }
  70. }
  71. public override String Name {
  72. get {
  73. return "Eventname";
  74. }
  75. }
  76. }
  77. }