I am calling a method "Foo(object s, Action action)" inside a library. Since, the function is itself involves some amount of execution time, i use CountDownEvents' to notify me when the function has done its job.
something like,
countdownEvent.Reset();
try
{
Foo(obj, ()=> countdownEvent.Signal());
}
catch(Exception e)
{
countdownEvent.Signal();
}
countdownEvent.Wait();
The part that I am not understanding is
- what is meant by () => countdownEvent.Signal() ? What is the "()=> " in particular stand for?
- Why did the method signature was not written Foo(object s, CountDownEvent event) and it can signal internally?
- I don't still really get an understanding of Action class. Googled a bit but just cant find some super simple examples to get started.
Any help is appreciated!