Home > Articles > Programming > .NET and Windows Programming

Programming with Generic Delegates in .NET

  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Generic delegates combine three powerful technologies: Lambda expressions, generics, and delegates. You'll find these elements everywhere in new versions of .NET. Paul Kimmel explains just how straightforward they really are.

Introduction

Sometimes I suspect that programmers learning their craft in the last five years got to skip a bunch of junk—like Dynamic Data Exchange (DDE), C, MAKE files, and assembler programming—and instead focus on the "good stuff." But, in truth, programming is evolutionary: Learning that "junk" really gives you a profound knowledge of how programs work and an easy understanding of new language features like Lambda expressions (as long as you keep learning).

The key to being a good programmer is never stop learning—and occasionally go back and fill in the blanks. Write some C and C++. Try your hand at assembler and make sure that you learn about delegates and anonymous delegates. They’ll help you to understand Lambda expressions. If you haven’t mastered generics (templates in C++), go back and study that material. Having a full toolbox of programming options is hypercritical to making magic.

In this article, we look at generic delegates; specifically, Action<T>, Func<T>, and Predicate<T>. These delegates are used everywhere in .NET now, and they encompass a lot of critical skills. Toward that end, let’s start our little odyssey.

  • Share ThisShare This
  • Save To Your Account

Discussions

comments powered by Disqus

Related Resources

#TuesdayTrivia: Spotlight on WP7 (Win a copy of Sams Teach Yourself Windows Phone 7 Application Development)
By on May 2, 2012Comments
These days, what CAN'T a smartphone do? Microsoft is putting their own spin on things to help you experience "life in motion" when using your device. Instead of containing static application icons, the re-imagined Start screen features live Tiles showing real-time content updates.

March Trivia #1: Let there be light! (Win Microsoft Visual Studio LightSwitch Unleashed)
By on March 13, 2012Comments
Want a simplified self-service tool to help you build business applications for the desktop and beyond? Microsoft programmers… meet Visual Studio LightSwitch.

February Trivia #2: There's an App for That (Win Sams Teach Yourself iOS 5 Application Development in 24 Hours)
By on February 28, 2012Comments
In less than a decade, the iOS platform has changed the way we think about mobile communication.

See All Related Blogs