Hello Everyone, In the article we will talk about Predicate
delegate.
Predicate is also a delegate which encapsulate a method that takes only one parameter and returns a bool value - true or false.
So in general Predicate is -
Hope you like reading the article. Please inbox me in case of any confusion.
Predicate is also a delegate which encapsulate a method that takes only one parameter and returns a bool value - true or false.
So in general Predicate is -
1. Which is contra variant
2. Takes one parameter and return true or false.
Let's
talk about some use case of predicates -
1. Let's say we want to filter some data in a collection. We
can provide a predicate which will take the input of collection and returns
bool value.
e.g. - In WPF when we implement list view filtering. It is
very useful
2. Some extension methods also take predicate as a
parameter. e.g - List.FindAll(predicate)
Please
have a look on implementation of predicate.Hope you like reading the article. Please inbox me in case of any confusion.
Happy Coding :)