An Idea About Multicast Delegate #8511
-
Now we can use ExampleAction act1 = Class1.methodX;
Action act2 = Class2.methodY;
Action act3 = act1 + act2;
act3 -= act2; The above is legal and there's no problem, but it would be more intuitive if the following code is legal as well. Action act = Class1.methodX + Class2.methodY; DrawbackSince methods are invoked sequentially in a multicast delegate, the new form may cause some problems. ConclusionIt seems that this proposal doesn't matter. However, I'd like to do some work to figure out if I can make it by overloading. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Just cast the first method to the Action act = (Action)Class1.methodX + Class2.methodY; It's because the compiler can't implies the type from |
Beta Was this translation helpful? Give feedback.
Just cast the first method to the
delegate
type:It's because the compiler can't implies the type from
method group
toAction