You are probably meaning lambda expressions and LINQ?
http://blogs.msdn.com/vbteam/archive...ion-trees.aspx
Here's an example
Public Class MySampleClass
Public Sub New(ByVal Name As String, ByVal City As String)
Me.Name = Name
Me.City = City
End Sub
Private _name As String
Private _city As String
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Public Property City() As String
Get
Return _city
End Get
Set(ByVal value As String)
_city = value
End Set
End Property
End Class
Dim l As New List(Of MySampleClass)
l.Add(New MySampleClass("Karl", "NY"))
l.Add(New MySampleClass("Mike", "NY"))
l.Add(New MySampleClass("Lars", "LA"))
Dim lookingFor As String = "NY"
Dim guys = From person In l _
Where person.City = lookingFor _
Select person
For Each p As MySampleClass In guys
Response.Write(p.Name)
Next
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke http://teemukeiski.net
"shapper" <md*****@gmail.comwrote in message
news:ed**********************************@s8g2000p rg.googlegroups.com...
Hello,
I have a List(Of MyClass).
MyClass has two properties: Name and City.
I want to find, without using a loop, if there is a item where name =
NameParameter.
I know that I can use a Predicate but in .NET 2.0 Predicates do not
accepted Parameters.
Because of that I used a Predicate Wrapper.
With .NET 3.5 I know this has changed and now it is much easier to do
something like this.
However, I can't find any example of it.
Can someone, please, help me out?
Thanks,
Miguel