public static IFunction AsFunction(__Delegate x) { if (x == null) return null; return x.InvokePointer; }
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 override __Delegate RemoveImpl(__Delegate d) { var j = -1; for (int i = 0; i < list.length; i++) { if (list[i] == d) { j = i; break; } } if (j > -1) list.splice(j, 1); if (list.length == 0) return null; return this; }
protected override __Delegate RemoveImpl(__Delegate d) { // 2015, could replace this by roslyn linq? var j = -1; for (int i = 0; i < list.length; i++) { if (list[i] == d) { j = i; break; } } if (j > -1) list.splice(j, 1); if (list.length == 0) return null; return this; }
protected virtual __Delegate CombineImpl(__Delegate d) { return null; //throw new global::System.Exception("use MulticastDelegate instead"); }
protected override __Delegate CombineImpl(__Delegate d) { list.push(d); return this; }
public static bool IsEqual(__Delegate a, __Delegate b) { // X:\jsc.svn\examples\javascript\Test\TestWebSQLDatabase\TestWebSQLDatabase\Application.cs if ((object)a == null) if ((object)b == null) return true; else return false; if ((object)b == null) return false; if (a.InternalMethod == b.InternalMethod) if (a.InternalTarget == b.InternalTarget) return true; return false; }
protected virtual __Delegate RemoveImpl(__Delegate d) { throw new global::System.Exception("use MulticastDelegate instead"); }
public static bool IsEqual(__Delegate a, __Delegate b) { if ((object)a == null) return false; if ((object)b == null) return false; return a.Method == b.Method && a.Target == b.Target; }
protected virtual __Delegate RemoveImpl(__Delegate d) { return default(__Delegate); }
protected virtual __Delegate CombineImpl(__Delegate d) { return default(__Delegate); }