Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# Querying With LINQ Functional Programming in C# Delegates

Ruth O'Kelly
Ruth O'Kelly
4,944 Points

Still unclear why we use delegates.

This video didn't really explain why we would ever need to use delegates. It just gave an example of how to make one.

2 Answers

Michael Milone
Michael Milone
1,474 Points

Delegates are useful when you want to call a method and you want the caller to handle its implementation.

Steven Parker
Steven Parker
217,573 Points

Like many aspects of programming, you rarely need to use them. But they can be useful for solving certain kinds of problems. But more likely, you might want to use a library function that requires a delegate as an argument, so it's good to know how to construct one.

You'll probably see some examples for practical uses later on in your course.