BeginInvoke on MulticaseDelegate and params keyword...

  • Thread starter Thread starter Zhenxin Li
  • Start date Start date
Z

Zhenxin Li

Hello,

If I use params keyword in my multicast delegate, can I call it using BeginInvoke? BeginInvoke takes some parameters after params keyword. I'm confused how to pass them after params...

Thanks!
Zhenxin Li
 
Just do what intellisense tells you.

params is just a caller convenience. It's really just an array.

delegate void D(params int[] p);
D d;

d.BeginInvoke(new int[]{1,2,3},cb,o);

Note that the arguments are NOT params in BeginInvoke so you can write d(1,2,3) but not d.BeginInvoke(1,2,3,cb,o)
Hello,

If I use params keyword in my multicast delegate, can I call it using BeginInvoke? BeginInvoke takes some parameters after params keyword. I'm confused how to pass them after params...

Thanks!
Zhenxin Li#
 
Yes. I was confused by intellisense. Thank you!
Just do what intellisense tells you.

params is just a caller convenience. It's really just an array.

delegate void D(params int[] p);
D d;

d.BeginInvoke(new int[]{1,2,3},cb,o);

Note that the arguments are NOT params in BeginInvoke so you can write d(1,2,3) but not d.BeginInvoke(1,2,3,cb,o)
Hello,

If I use params keyword in my multicast delegate, can I call it using BeginInvoke? BeginInvoke takes some parameters after params keyword. I'm confused how to pass them after params...

Thanks!
Zhenxin Li#
 
Back
Top