5 // Miguel de Icaza (miguel@ximian.com)
7 // (C) Ximian, Inc. http://www.ximian.com
9 // TODO: Mucho left to implement
13 using System.Globalization;
14 using System.Runtime.Serialization;
18 public abstract class Delegate : ICloneable, ISerializable {
19 protected Type target_type;
20 protected object m_target;
21 protected string method;
22 protected IntPtr method_ptr;
24 protected Delegate (object target, string method)
27 throw new ArgumentNullException (Locale.GetText ("Target object is null"));
30 throw new ArgumentNullException (Locale.GetText ("method name is null"));
32 this.target_type = null;
33 this.method_ptr = IntPtr.Zero;
34 this.m_target = target;
38 protected Delegate (Type target_type, string method)
41 throw new ArgumentNullException (Locale.GetText ("Target type is null"));
44 throw new ArgumentNullException (Locale.GetText ("method string is null"));
46 this.target_type = target_type;
47 this.method_ptr = IntPtr.Zero;
53 public MethodInfo Method {
60 public object Target {
71 public abstract object Clone ();
73 public override bool Equals (object o)
75 if (!(o is System.Delegate))
78 Delegate d = (Delegate) o;
80 if ((d.target_type == target_type) &&
81 (d.m_target == m_target) &&
88 public override int GetHashCode ()
90 return method.GetHashCode ();
93 // This is from ISerializable
94 public void GetObjectData (SerializationInfo info, StreamingContext context)
99 public static Delegate Combine (Delegate a, Delegate b)
109 if (a.GetType () != b.GetType ())
110 throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types"));
112 return a.CombineImpl (b);
115 protected virtual Delegate CombineImpl (Delegate d)
117 throw new MulticastNotSupportedException ("");
120 public static Delegate Remove( Delegate source, Delegate value) {
121 throw new NotImplementedException ();