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;
19 public abstract class Delegate : ICloneable, ISerializable {
20 protected Type target_type;
21 protected object m_target;
22 protected string method;
23 protected IntPtr method_ptr;
25 protected Delegate (object target, string method)
28 throw new ArgumentNullException (Locale.GetText ("Target object is null"));
31 throw new ArgumentNullException (Locale.GetText ("method name is null"));
33 this.target_type = null;
34 this.method_ptr = IntPtr.Zero;
35 this.m_target = target;
39 protected Delegate (Type target_type, string method)
42 throw new ArgumentNullException (Locale.GetText ("Target type is null"));
45 throw new ArgumentNullException (Locale.GetText ("method string is null"));
47 this.target_type = target_type;
48 this.method_ptr = IntPtr.Zero;
54 public MethodInfo Method {
61 public object Target {
72 public abstract object Clone ();
74 public override bool Equals (object o)
76 if (!(o is System.Delegate))
79 Delegate d = (Delegate) o;
81 if ((d.target_type == target_type) &&
82 (d.m_target == m_target) &&
89 public override int GetHashCode ()
91 return method.GetHashCode ();
94 // This is from ISerializable
96 public void GetObjectData (SerializationInfo info, StreamingContext context)
101 public static Delegate Combine (Delegate a, Delegate b)
111 if (a.GetType () != b.GetType ())
112 throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types"));
114 return a.CombineImpl (b);
117 protected virtual Delegate CombineImpl (Delegate d)
119 throw new MulticastNotSupportedException ("");
122 public static Delegate Remove( Delegate source, Delegate value) {
123 throw new NotImplementedException ();