Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Searches for an element that matches the conditions defined by the specified predicate

Imports System Imports System.Drawing Public Class Example     Public Shared Sub Main()         Dim points() As Point = { new Point(10, 20),new Point(10, 20), new Point(20, 35),new Point(25, 35), new Point(25, 40) }         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 > 100 Then             Return True         Else             Return False         End If     End Function End Class