Difference between Delegate, Function and Predicates

Delegates
  • A delegate is a method with a parameter and a return type.
  • A delegate is a type that safely encapsulates a method.
  • Delegates are object-oriented, type safe, and secure.
Special Notes
 
               We can’t derive a custom class from the delegates because it is sealed.

Functions:

               A function allows you to encapsulate a piece of code and call it from the other parts of your code.

Predicate:

  • Predicate is a functional construct, providing a convenient way of basically testing if something is true of a given T object.
  • Predicates are simply delegates that returns booleans.
  • They're useful when you're searching through a collection of objects and want something specific.
Ebook Download
View all
Learn
View all