Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Class CaseInsensitiveArrayList
Inherits ArrayList
Public Sub New()
MyBase.New()
End Sub
Private Function SearchEntry(ByVal value As Object) As String
Dim SearchValue As String = Convert.ToString(value).ToLower
For Each Entry As String In Me
If Entry.ToLower = SearchValue Then
Return Entry
End If
Next
Return Nothing
End Function
Public Overrides Function Contains(ByVal value As Object) As Boolean
If SearchEntry(value) Is Nothing Then
Return False
Else
Return True
End If
End Function
Public Overloads Overrides Function IndexOf(ByVal value As Object) As Integer
Dim Entry As String = SearchEntry(value)
If Entry Is Nothing Then
Return -1
Else
Return MyBase.IndexOf(Entry)
End If
End Function
Public Overloads Overrides Function IndexOf(ByVal value As Object, ByVal startIndex As Integer) As Integer
Dim Entry As String = SearchEntry(value)
If Entry Is Nothing Then
Return -1
Else
Return MyBase.IndexOf(Entry, startIndex)
End If
End Function
Public Overloads Overrides Function IndexOf(ByVal value As Object, ByVal startIndex As Integer, ByVal count As Integer) As Integer
Dim Entry As String = SearchEntry(value)
If Entry Is Nothing Then
Return -1
Else
Return MyBase.IndexOf(Entry, startIndex, count)
End If
End Function
Public Overloads Overrides Function LastIndexOf(ByVal value As Object) As Integer
Dim Entry As String = SearchEntry(value)
If Entry Is Nothing Then
Return -1
Else
Return MyBase.LastIndexOf(Entry)
End If
End Function
Public Overloads Overrides Function LastIndexOf(ByVal value As Object, ByVal startIndex As Integer) As Integer
Dim Entry As String = SearchEntry(value)
If Entry Is Nothing Then
Return -1
Else
Return MyBase.LastIndexOf(Entry, startIndex)
End If
End Function
Public Overloads Overrides Function LastIndexOf(ByVal value As Object, ByVal startIndex As Integer, ByVal count As Integer) As Integer
Dim Entry As String = SearchEntry(value)
If Entry Is Nothing Then
Return -1
Else
Return MyBase.LastIndexOf(Entry, startIndex, count)
End If
End Function
Public Overrides Sub Remove(ByVal value As Object)
Dim Entry As String = SearchEntry(value)
If Entry Is Nothing Then Return
MyBase.Remove(Entry)
End Sub
End Class