Predicate generic delegation
Defines a set of conditions and determines whether the specified object meets these conditions. This delegatedArrayAndListUsed to search for elements in a collection.
Let's take a look at its definition below:
// Summary:
// Represents the method that defines a set of criteria and determines whether
// The specified object meets those criteria.
//
// Parameters:
// Obj:
// The object to compare against the criteria defined within the method represented
// By this delegate.
//
// Type parameters:
// T:
// The type of the object to compare.
//
// Returns:
// True if obj meets the criteria defined within the method represented by this
// Delegate; otherwise, false.
Public delegate bool Predicate <T> (T obj );
Type parameters:
T:Type of the object to be compared.
Obj:Objects to be compared according to the conditions defined in the methods represented by this delegate.
Return Value: IfObjIf the conditions defined in the methods represented by this delegate are metTrueOtherwiseFalse.
See the following code:
Public class GenericDelegateDemo
{
List <String> listString = new List <String> ()
{
"One", "Two", "Three", "Four", "Fice", "Six", "Seven", "Eight", "Nine", "Ten"
};
String [] arrayString = new String []
{
"One", "Two", "Three"