views:

42

answers:

1

I have

public delegate void DocumentCompleteEventHandler(object pDisp, ref object URL)

Can i use lambda expression such as :

ie.DocumentComplete += (o, e) => {  };

It expression doesn't work. How should i change it for using in code? Is it possible?

+6  A: 

Have you tried:

ie.DocumentComplete += (object o, ref object e) => {};

Sometimes the compiler can't figure out things through pure inference and you need to specify the labmda argument types (and modifiers.) Note that it's an all-or-nothing thing: you must given types for all arguments or not at all.

p.s. I'm waiting for a certain Mr. Skeet to hop in here and paste in an essay to steal all of my points.

x0n
Thanks! It work!
Rover
@rover, ok then please mark my reply as the answer. Thank you!
x0n
You're too fast ))) I'll do it in 8 minutes
Rover