Predicate in c# and Its use case
Predicate delegate takes only one argument and returns a boolean value. Example: static void Main () { // return true if passed argument is greater than 4 Predicate< int > greaterThanFour = (n) => n> 4 ; Console.WriteLine(greaterThanFour( 4 )); //false } It is the very basic example of predicate, which returns true if number is greater than four otherwise it returns false. You already have used the predicate if you have used the LINQ. List<Order> orders = new List<Order> { new Order { OrderId = 101 , Status = "Pending" }, new Order { OrderId = 102 , Status = "Completed" }, new Order { OrderId = 103 , Status = "Cancelled" }, new Order { OrderId = 104 , Status = "Completed" } }; // Find order with id 104 var order = orders.Find(o => o.OrderId == 104 ); The find method takes the predicate as the parameter. Which returns true if it finds the order with id 104 . Which i...