Check if a custom list (of x) contains an item before adding it

  • Thread starter Thread starter wingers
  • Start date Start date
W

wingers

Guest
Hi all

I have a custom class to store some information e.g.


Public Class Jobs
Public Property _Source As String
Public Property _Destination As String
End Class

I am adding to it like below, but I want to check first to make sure the _Source I am adding doesn't already exist

Dim JobList As New List(Of Jobs)()

Dim _JI As New Jobs
_JI._Source = My.Computer.FileSystem.SpecialDirectories.MyPictures
_JI._Destination = "c:\test"
JobList.Add(_JI)



Normally I would use 'If Not JobList.Contains("") Then' but this doesn't seem to work with a list of my own class

Am I missing something obvious or is there a better way to achieve this?

Thanks





Darren Rose

Continue reading...
 
Back
Top