protected override __Delegate CombineImpl(__Delegate d) { var a = new __Delegate[InternalInvocationList.Length + 1]; Array.Copy(InternalInvocationList, a, InternalInvocationList.Length); a[InternalInvocationList.Length] = d; InternalInvocationList = a; return(this); }
public static __Delegate Remove(__Delegate source, __Delegate value) { if (source == null) { return(null); } if (value == null) { return(source); } return(source.RemoveImpl(value)); }
public static __Delegate Combine(__Delegate a, __Delegate b) { if (a == null) { return(b); } if (b == null) { return(a); } return(a.CombineImpl(b)); }
protected override __Delegate RemoveImpl(__Delegate d) { var j = -1; for (int i = 0; i < InternalInvocationList.Length; i++) { if (InternalInvocationList[i] == d) { j = i; } } if (j >= 0) { // removing last element will result in a null delegate // other languages shall be updated to behave the same... if (InternalInvocationList.Length == 1) { return(null); } var a = new __Delegate[InternalInvocationList.Length - 1]; for (int i = 0; i < InternalInvocationList.Length; i++) { if (i < j) { a[i] = InternalInvocationList[i]; } else { if (i > j) { a[i - 1] = InternalInvocationList[i]; } } } InternalInvocationList = a; } return(this); }
protected virtual __Delegate RemoveImpl(__Delegate d) { return(default(__Delegate)); }
protected virtual __Delegate CombineImpl(__Delegate d) { return(default(__Delegate)); }