Tuesday, June 8, 2010

Distinct in Array List

So simple...

Public

Function RemoveALDuplicates(ByRef alList As ArrayList) As ArrayList

Dim

ret As New ArrayList

Dim iCount As Integer

For iCount = 0 To alList.Count - 1

Dim sObj As String 'or whatever the object type is

sObj = alList(iCount)

If ret.Contains(sObj) = False Then

ret.Add(sObj)

End If

Next

Return ret

Return ret
End Function

No comments:

Post a Comment