help converting to

Apr 7, 2009 at 4:14 AM
Edited Apr 7, 2009 at 4:20 AM
I am struggling to write the event handler for percent done in  Could anyone take a stab and help?
i have tried to use the converters on the web and they bug out.
specifically, i am trying to convert this piece from the example code:

tmp.FileCompressionStarted += new EventHandler<FileInfoEventArgs>((s, e) =>
    Console.WriteLine(String.Format("[{0}%] {1}",
    e.PercentDone, e.FileInfo.Name));

Thanx in advance,

Apr 15, 2009 at 5:37 PM
I took a shot at trying to convert the code as well, and got stuck on the same point as you.

Apparently, doesn't support anonymous event delegates in the way that c# does,
 at least I haven't been able to get them converted to an acceptable syntax.

The article at this link has some discussion of lambda event handlers in,
  but I still haven't been able to figure out how to convert those sections of the code.

Maybe some c# guru has the answer. Anyone?

Apr 15, 2009 at 7:49 PM
You absolutely don't have to use any lambda. Consider this alternative C# code:

[your method]
tmp.FileCompressionStarted += new EventHandler<FileInfoEventArgs>(tmp_FileCompressionStarted);

[method outside yours]
static void tmp_FileCompressionStarted(object sender, FileInfoEventArgs e)
        //place event code here