C# CS1502:最佳重载匹配未在文档中找到正确的函数

C# CS1502: Best Overloaded Match not finding the correct function in the docs

我正在使用 C# Mono 编译器,由于无法在文档中找到正确的函数,编译器一直给我 CS1502 错误。具体来说,我在字符串 API 中的 Split 函数中遇到问题,并显示以下消息

The best overloaded method match for `string.Split(params char[])' has some invalid arguments

当我尝试使用本页概述的 Split(String[], StringSplitOptions) 函数时:https://msdn.microsoft.com/en-us/library/tabh47cf(v=vs.110).aspx

,可在 API 文档中找到:https://msdn.microsoft.com/en-us/library/system.string(v=vs.110).aspx

编辑: 我想写的代码是这样的:

words = line.Split("\t");

我正在尝试将制表符分隔的字符串(变量“line”)拆分为字符串数组“words” .

使用单引号与双引号将制表符 (\t) 作为 char 而不是 string 传递,即:

words = line.Split('\t');