【发布时间】:2018-03-15 00:48:31
【问题描述】:
我经常遇到过载问题, 我已经查过了,但似乎没有什么像我的情况...... 我希望这里的人能帮助我。 我的代码示例如下所示。
string s = textbox.text;
char[] delimiter = {' '};
string[] word = s.split(delimiter); //this gets a set of words from s.split
for (int i = 0; i <= word.length; i++) //I also tried word.count()
{
int ii = 0;
int counter = wordlist.count;
bool test1 = false;
while (test1 == false || ii != counter +1)
{
if (word[i] == wordlist[ii]) //this is where it gets stuck. It wants to load more word[i] than what there are in the list...
{
//function gets preformed
test1 = true;
}
else
{
ii++;
}
}
}
请帮助我,我的脚本的这一部分很重要... 感谢您的宝贵时间!
【问题讨论】:
-
在这种情况下
wordlist是什么? -
哦,抱歉,wordlist 是一组预加载的单词,代码基本上需要将您输入的单词与它知道的单词匹配。感谢您的回复!
-
抱歉,这是它允许的唯一问题,我检查了它建议的所有其他问题,但没有任何匹配项。基本上,当单词[i] 需要在其最后一个条目处停止时,它会不断过载。这就是问题所在......我尝试的函数是 for 函数中的计数和长度,并且都超过了 word[] 中的单词数量
-
int i = 0;我
标签: c# count overloading