I have a question about the string.intersect method.
I am not getting the results I expect.
Dim lstChars1() As Char = "hello dolly" 'TextBox1.Text.ToCharArray
Dim lstchars2() As Char = "help melanie" 'TextBox2.Text.ToCharArray
Dim lst1 As New List(Of String)
Dim lst2 As New List(Of String)
For Each c In lstChars1
lst1.Add(c.ToString)
Next
For Each c In lstchars2
lst2.Add(c)
Next
Dim lstNew As IEnumerable(Of String) = Nothing
lstNew = lst1.Intersect(lst2, StringComparer.OrdinalIgnoreCase)
lstNew contains "h", "e", "l", " "
I expected another 'l", What's the reason for this behavior? I have also attempted this using arrays and received the same values.
Thanks In Advance