Public Function Validate(updatedDetailList As List(Of DetailVO)) As Boolean
Dim matchFound As Boolean = False
For Each firstUpdatedDetail In updatedDetailList
For Each nextUpdatedDetail In updatedDetailList
If firstUpdatedDetail.PROD_ID.Equals(nextUpdatedDetail.PROD_ID) Then
matchFound = True
End If
Next nextUpdatedDetail
Next firstUpdatedDetail
Return matchFound
End Function
我有updatedDetailList
一个列表,我想迭代并获取当前和下一个对象值并比较这两个值。如果您发现相同PROD_ID
,updatedDetailList
则返回matchFound
为TRUE
。
有什么方法可以在内部 For 循环中获取下一个对象。像...
For Each firstUpdatedDetail In **updatedDetailList**
For Each nextUpdatedDetail In **updatedDetailList.Next**
If firstUpdatedDetail.PROD_ID.Equals(nextUpdatedDetail.PROD_ID) Then
matchFound = True
End If
Next nextUpdatedDetail
Next firstUpdatedDetail