4
How to look for a String
in a List(Of String)
without considering the case?
I’m using . net 2.0.
Contains
does not allow passing any additional parameter. I tried to use Find
but it didn’t work either.
Dim v_list As New List(Of String)(New String() {"a", "b", "c"})
Dim v_contains As Boolean
v_contains = v_list.Contains("A")
v_contains = v_list.Find(Function(x) String.Compare(x, "A", True))
Wouldn’t it be good to use the
Count
?– Jéf Bueno
@jbueno Sim,
Count<T>()
is another possibility. To be honest, I don’t know what is the most recommended solution, I don’t have as much practice with . net.– bfavaretto
Count<T>()
does not work, since it comes from Linq - which was only introduced in . NET 3.5, and AP mentioned that it is using . NET 2.0.– carlosfigueira