vb.net - List(of String()) contains String() -


i trying find out if array of strings exists in list of arrays of strings, running confusion. here code:

dim listresults list(of string) dim liststringarrays list(of string()) dim string() = {"foo", "bar", "stuff"} dim otherthing string() = {"foo", "bar", "stuff"}  liststringarrays.add(something)  if liststringarrays.contains(otherthing) listresults.add("true") else listresults.add("false") end if  if liststringarrays(0).equals(otherthing) listresults.add("true") else listresults.add("false") end if 

listresults contain 2 "false". strangely:

something(0) = otherthing(0) something(1) = otherthing(1) something(2) = otherthing(2) 

these evaluate true. how can find out if liststringarrays contains otherthing if contains not work?

bonus question: why contains not work in instance?

two arrays same contents still not same array. something = otherthing false. that's why contains doesn't work.

you instead use sequenceequal see whether of arrays in liststringarrays have same contents otherthing.

if liststringarrays.any(function(t) t.sequenceequal(otherthing)) 

Comments

Popular posts from this blog

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -