Is it interesting how the same code can be both valid C # and VB.NET, but at the same time give completely different results? I noticed that there was no end semicolon, but suggested that it was just an artifact of copy and paste.
Using the following code ...
Dim text As String = "Blah blah - WebSite - 9/20/2017 - Containers remaining changed to 0." Dim list1 As List(Of String) = text.Split("Containers remaining changed to ").ToList()
... IntelliSense indicates what causes the String.Split(ParamArray() separator as Char()) overload ( MSDN documentation includes the ParamArray modifier) ...

After executing, list1 then contains the following:
list1(0) = "Blah blah - WebSite - 9/20/2017 - " list1(1) = "ontainers remaining changed to 0."
If you write it using this seemingly equivalent syntax ...
Dim list2 As List(Of String) = text.Split("C", "o", "n", "t", "a", "i", "n", "e", "r", "s", " ", "r", "e", "m", "a", "i", "n", "i", "n", "g", " ", "c", "h", "a", "n", "g", "e", "d", " ", "t", "o", " ").ToList() Dim list3 As List(Of String) = text.Split("Containers remaining changed to ".ToCharArray()).ToList()
... IntelliSense indicates that both .Split() calls allow the same overload as above, but the results for list2 very different ...
list2(0) = "Bl" list2(1) = "" list2(2) = "" list2(3) = "bl" list2(4) = "" list2(5) = "" list2(6) = "-" list2(7) = "W" list2(8) = "bS" list2(9) = "" list2(10) = "" list2(11) = "" list2(12) = "-" list2(13) = "9/20/2017" list2(14) = "-" list2(15) = "" list2(16) = "" list2(17) = "" list2(18) = "" list2(19) = "" list2(20) = "" list2(21) = "" list2(22) = "" list2(23) = "" list2(24) = "" list2(25) = "" list2(26) = "" list2(27) = "" list2(28) = "" list2(29) = "" list2(30) = "" list2(31) = "" list2(32) = "" list2(33) = "" list2(34) = "" list2(35) = "" list2(36) = "" list2(37) = "" list2(38) = "" list2(39) = "" list2(40) = "" list2(41) = "" list2(42) = "" list2(43) = "" list2(44) = "" list2(45) = "" list2(46) = "" list2(47) = "0."
... and the same for list3 . In fact, we expected list1 be all the time, since it would split into any of the characters in the passed String .
Why is this happening? I find this interesting, although I am not a VB.NET guy, so maybe this is a common knowledge / trap. If we look at what the compiler produces , we see the following:
Dim text As String = "Blah blah - WebSite - 9/20/2017 - Containers remaining changed to 0." Dim arg_13_0 As String = text Dim expr_0E As Char() = New Char(0) {} expr_0E(0) = "C"c Dim list As List(Of String) = arg_13_0.Split(expr_0E).ToList(Of String)() Dim arg_31_0 As String = text Dim expr_26 As Char() = New Char(31) {} RuntimeHelpers.InitializeArray(expr_26, fieldof(<PrivateImplementationDetails>.B46FB904AE74F7001A264BB77882D707B0E9ECC7).FieldHandle) Dim list2 As List(Of String) = arg_31_0.Split(expr_26).ToList(Of String)() Dim list3 As List(Of String) = text.Split("Containers remaining changed to ".ToCharArray()).ToList(Of String)()
That is, in the case of list2 it passes a Char array consisting of all Char to "Containers remaining changed to " , but in the case of list1 it passes a Char array consisting of only the first Char , "C"c ! Talk about the different results of a similar code ...
I can not find a single document that connects all these points, but basically String will be implicitly converted to Char() , which calls the CChar conversion function , which returns only the first Char . Thus, the following four lines are equivalent:
Dim list1a As List(Of String) = text.Split("Containers remaining changed to ").ToList() Dim list1b As List(Of String) = text.Split(CChar("Containers remaining changed to ")).ToList() Dim list1c As List(Of String) = text.Split("C").ToList() Dim list1d As List(Of String) = text.Split("C"c).ToList()