Murach's C#
How to code methods and event handlers

First, this chapter shows you how to code and call methods and how to generate event handlers for all types of events. Then, it shows you how delegates are used to wire an event to a method so you can change that wiring whenever you need to. This is an essential skill that is either treated too lightly or too late in other books.

Chapter 6 How to code methods and event handlers
How to code and call methods 154
How to code methods 154
How to call methods 156
When and how to pass arguments by reference and by value 158
How to work with events and delegates 160
How to generate an event handler for any event 160
How event wiring works 162
How to handle multiple events with one event handler 164
Another version of the Future Value application 166
The event handlers and the CalculateFutureValue method 166
Some of the generated code 168




Murach's C#

Learn more about this book

Add this book to your cart

Download this chapter



Our Ironclad Guarantee

First, try our books for 90 days. Then, if you aren't completely convinced that our books are the best ones you've ever used, you can return them for a full refund...no questions asked.