Skip to main content
Top

12. Delegates, Events, and Lambda Expressions

  • 2021
  • OriginalPaper
  • Chapter
Published in:

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

This chapter delves into the intricacies of delegates, events, and lambda expressions in C# programming. It begins by explaining the historical context of callback mechanisms and their importance in graphical user interfaces. The text then explores the delegate type in .NET Core, highlighting its type-safe nature and ability to handle multicasting. It provides practical examples, such as creating a delegate to point to methods and using delegate types to define and respond to callbacks. The chapter also covers the C# event keyword, which simplifies event handling and ensures encapsulation. Additionally, it introduces anonymous methods and lambda expressions, showcasing how they can streamline event registration and provide concise syntax for handling events. The chapter concludes by demonstrating how to use lambda expressions with multiple parameters and how to integrate them into real-world applications. Throughout the chapter, the author emphasizes the importance of understanding the underlying mechanisms and provides clear, concise explanations that make complex topics accessible to developers.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Business + Economics & Engineering + Technology"

Online-Abonnement

Springer Professional "Business + Economics & Engineering + Technology" gives you access to:

  • more than 102.000 books
  • more than 537 journals

from the following subject areas:

  • Automotive
  • Construction + Real Estate
  • Business IT + Informatics
  • Electrical Engineering + Electronics
  • Energy + Sustainability
  • Finance + Banking
  • Management + Leadership
  • Marketing + Sales
  • Mechanical Engineering + Materials
  • Insurance + Risk


Secure your knowledge advantage now!

Springer Professional "Engineering + Technology"

Online-Abonnement

Springer Professional "Engineering + Technology" gives you access to:

  • more than 67.000 books
  • more than 390 journals

from the following specialised fileds:

  • Automotive
  • Business IT + Informatics
  • Construction + Real Estate
  • Electrical Engineering + Electronics
  • Energy + Sustainability
  • Mechanical Engineering + Materials





 

Secure your knowledge advantage now!

Springer Professional "Business + Economics"

Online-Abonnement

Springer Professional "Business + Economics" gives you access to:

  • more than 67.000 books
  • more than 340 journals

from the following specialised fileds:

  • Construction + Real Estate
  • Business IT + Informatics
  • Finance + Banking
  • Management + Leadership
  • Marketing + Sales
  • Insurance + Risk



Secure your knowledge advantage now!

Title
Delegates, Events, and Lambda Expressions
Authors
Andrew Troelsen
Phillip Japikse
Copyright Year
2021
Publisher
Apress
DOI
https://doi.org/10.1007/978-1-4842-6939-8_12

Premium Partner

    Image Credits
    Neuer Inhalt/© ITandMEDIA, Nagarro GmbH/© Nagarro GmbH, AvePoint Deutschland GmbH/© AvePoint Deutschland GmbH, AFB Gemeinnützige GmbH/© AFB Gemeinnützige GmbH, USU GmbH/© USU GmbH, Ferrari electronic AG/© Ferrari electronic AG