namespace System
{
+ [System.Runtime.InteropServices.ComVisible (true)]
+ [Serializable]
public abstract class MulticastDelegate : Delegate
{
private MulticastDelegate prev;
prev = null;
}
- protected MulticastDelegate (Type target_type, string method)
- : base (target_type, method)
+ protected MulticastDelegate (Type target, string method)
+ : base (target, method)
{
prev = null;
}
return base.DynamicInvokeImpl (args);
}
+ internal bool HasSingleTarget {
+ get { return prev == null; }
+ }
// <remarks>
// Equals: two multicast delegates are equal if their base is equal
// and their invocations list is equal.
// </remarks>
- public sealed override bool Equals (object o)
+ public sealed override bool Equals (object obj)
{
- if (!base.Equals (o))
+ if (!base.Equals (obj))
return false;
- MulticastDelegate d = (MulticastDelegate) o;
-
+ MulticastDelegate d = obj as MulticastDelegate;
+ if (d == null)
+ return false;
+
if (this.prev == null) {
if (d.prev == null)
return true;
throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types."));
combined = (MulticastDelegate)follow.Clone ();
+ combined.SetMulticastInvoke ();
for (clone = combined, orig = ((MulticastDelegate)follow).prev; orig != null; orig = orig.prev) {
return retval;
}
- public static bool operator == (MulticastDelegate a, MulticastDelegate b)
+ public static bool operator == (MulticastDelegate d1, MulticastDelegate d2)
{
- if ((object)a == null) {
- if ((object)b == null)
- return true;
- return false;
- }
- return a.Equals (b);
+ if (d1 == null)
+ return d2 == null;
+
+ return d1.Equals (d2);
}
- public static bool operator != (MulticastDelegate a, MulticastDelegate b)
+ public static bool operator != (MulticastDelegate d1, MulticastDelegate d2)
{
- return !(a == b);
+ if (d1 == null)
+ return d2 != null;
+
+ return !d1.Equals (d2);
}
}
}