APM: the asynchronous programming model (asynchronous programming model) beginxxx
EAP: The Event-base asynchronous pattern (Event-based programming mode) button. Click + = ........
EPM: The Event-base programming model
1. In essence, EAP also uses APM internally, but it only implements some encapsulation. Therefore, EAP will use more memory space (such as eventargs) and GC operations.
2. In simple cases, the PEM is generally a better choice and is also easier to use. Some restrictions on the PEM include:
1) the event must be registered before the Asynchronous Method is executed. Otherwise, the event may not be executed.
2) If you do not want to use an event, you must log off the event. (The event often causes memory leakage. If you are interested, you can check the events with weak references)
3) The static method and Singleton class should not use EPM. (I personally do not agree with this idea. The original Article in this book is:Static methods and Singleton classes cannot offer the EPM)
4) EAP cannot use catch to handle exceptions.