How to write a contains statement to match a member of a class?

Posted by afuzzyllama on Stack Overflow See other posts from Stack Overflow or by afuzzyllama
Published on 2011-11-17T17:32:17Z Indexed on 2011/11/17 17:50 UTC
Read the original article Hit count: 207

If I have the following structure:

Public Class UserData
    Public ID As String
    Public Name As String
End Class

How can I select it in a conditional like this?

Dim myUsers As New List(Of UserData)

If myUsers.Contains(.ID = "1") = True Then
    ...

I know that myUsers.Contains(.ID = "1") is totally wrong, but I am curious how to do something like that? Is it possible? Is this a job for LINQ?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net