Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27508

VS 2010 How to check for existing items in a list of a public structure

$
0
0
How can I check a potential new record against existing records in a list?

I have this code.

vbNET Code:
  1. Public Structure EmailDetails
  2.         Private _ItemID As ItemId
  3.         Private _from As String
  4.         Private _subject As String
  5.         Private _attachments As List(Of Attachment)
  6.         Public Sub New(ByVal itemID As ItemId, ByVal mFrom As String, ByVal subject As String, ByVal attachments As List(Of Attachment))
  7.             _ItemID = itemID
  8.             _from = mFrom
  9.             _subject = subject
  10.             _attachments = attachments
  11.         End Sub
  12.  
  13.     End Structure
  14.  
  15.     Private _emailDetails As New List(Of EmailDetails)
  16.  
  17.     Public Sub OnAttachmentsFound(ByRef item As Item, ByRef mFrom As String) Handles Me.AttachmentsFound
  18.  
  19.         _emailDetails.Add(New EmailDetails(item.Id, mFrom, item.Subject, item.Attachments.ToList))
  20.  
  21.     End Sub

I was thinking something a long the lines of a Boolean variable that has a Linq expression that will return true if my query returns true.

Viewing all articles
Browse latest Browse all 27508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>