Free mag vol1 | Page 755

CHAPTER 19  MULTITHREADED, PARALLEL, AND ASYNC PROGRAMMING Recall that the generated Invoke() method is used to invoke the methods maintained by a delegate object in a synchronous manner. Therefore, the calling thread (such as the primary thread of the application) is forced to wait until the delegate invocation completes. Also recall that in C#, the Invoke() method does not need to be directly called in code, but can be triggered indirectly, under the hood, when applying “normal” method invocation syntax. Consider the following Console Application program (SyncDelegateReview), which invokes the static Add() method in a synchronous