I'm using an overload of String.Split
that the docs says is a valid overload (string
, then StringSplitOptions
).
string separatingString = "<<";
string text = "one<<two......three<four";
string[] words = text.Split(separatingString, System.StringSplitOptions.None);
foreach (var word in words)
{
System.Console.WriteLine(word);
}
When I compile this directly with csc.exe (Visual C# Compiler version 4.2.0-4.22252.24) I get errors:
split_strings_issue_2.cs(3,29): error CS1503: Argument 1: cannot convert from 'string' to 'char'
split_strings_issue_2.cs(3,47): error CS1503: Argument 2: cannot convert from 'System.StringSplitOptions' to 'char'
Why won't the compiler accept a string in String.Split()
? Why do the docs state that it should?