Predicate(T) Delegate represents the method that defines a set of criteria : Lambda « Language Basics « VB.Net






Predicate(T) Delegate represents the method that defines a set of criteria

 

Imports System
Imports System.Drawing

Public Class Example

    Public Shared Sub Main()
        Dim points() As Point = { new Point(275, 395), new Point(295, 450) }

        Dim first As Point = Array.Find(points, AddressOf ProductGT10)
        Console.WriteLine("Found: X = {0}, Y = {1}", first.X, first.Y)
    End Sub

    Private Shared Function ProductGT10(ByVal p As Point) As Boolean
        If p.X * p.Y > 100000 Then
            Return True
        Else
            Return False
        End If
    End Function
End Class

   
  








Related examples in the same category

1.Func(T, TResult) represents a method that has one parameter and returns one value
2.Instantiate delegate to reference method
3.Lambda Expression and Function
4.Declare a Func variable and assign a lambda expression to the variable
5.Converter(TInput, TOutput) Delegate represents a method that converts an object from one type to another type.
6.Func(TResult) Delegate represents a method with no parameters returning a value of the type specified by the TResult parameter.