Mono Class Library: System.Delegate Overview | MembersSystem.Delegate.Combine Method |
Concatenates the invocation lists of the specified delegates. [Edit]
|
A delegate, or null .
The following table describes the value returned when a or b is null .
a b Return Value null null null null non-null b non-null null a When a and b are non-null, this method returns a new delegate with the concatenated invocation lists of a and b .
[Edit]
Type Reason ArgumentException a and b are not null and not of the same type. [Edit]
Unless a or b is null , a and b are required to be the exact same type.
Consider the following situation, in which D1, D2, D3, D4, and D5 are delegate instances of the same type, D1's invocation list has one entry, E1, and D2's invocation list has one entry, E2.
Then, D3 = Combine(D1, D2) results in D3's having an invocation list of E1 + E2.
Then, D4 = Combine(D2, D1) results in D4's having an invocation list of E2 + E1.
Then, D5 = Combine(D3, D4) results in D5's having an invocation list of E1 + E2 + E2 + E1.
Note:[Edit]The invocation list of the returned delegate can contain duplicate methods.
Delegate.Combine(Delegate, Delegate) is useful for creating event handlers that call multiple methods each time an event occurs.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0