O'Reilly logo

MCSD Certification Toolkit (Exam 70-483): Programming in C# by Gerry O'Brien, Vincent Varallo, Rod Stephens, Tiberiu Covaci

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6

Working with Delegates, Events, and Exceptions

What You Will Learn in This Chapter

  • Understanding delegates and predefined delegate types
  • Using anonymous methods including lambda expressions
  • Publishing and subscribing to events
  • Allowing derived classes to raise base class events
  • Catching, throwing, and rethrowing exceptions
  • Creating custom exceptions

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

You can find the code downloads for this chapter at www.wrox.com/remtitle.cgi?isbn=1118612094 on the Download Code tab. The code is in the chapter11 download and individually named according to the names throughout the chapter.

Chapter 3, “Working with the Type System,” explained data types including predefined types (such as int and string), data structures, and enumerations. For example, the following code snippet defines a Person structure that groups a person’s name and address information:

struct Person
{
    public string FirstName, LastName, Street, City, State, ZIP;
}

This chapter explains delegates, data types that define kinds of methods. It also explains events (which use delegates), exceptions, and error handling.

Table 6-1 introduces you to the exam objectives covered in this chapter.

Table 6-1: 70-483 Exam Objectives Covered in This Chapter

ObjectiveContent Covered
Manage program flowCreate and implement events and callbacks. This includes creating event handlers, subscribing and unsubscribing from events, using built-in delegate types to create events, creating delegates, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required