【发布时间】:2013-12-23 14:02:26
【问题描述】:
我想把所有不包含“时间”这个词的词放在一个组合框中。
我试过了:
foreach (string stt in LTypes)
{
//if the stat name does not contains TIME
//Only then we add it to the combobox.
if (!stt.Contains("Time"))
{
tcomboBox1.Items.Add(stt);
}
}
但上述方法不起作用。 不起作用我的意思是包含“时间”的单词也被插入到组合框中。
我哪里做错了?
【问题讨论】:
-
我想你忘了提到这些的大小写方式不同。我错了吗?
Time与time不同。 -
是你填充组合框的那个地方吗?您还可以提供添加了
Time的示例字符串吗? -
什么是
LTypes?运行上面的代码会发生什么? -
LTypes 显然是一个 IEnumerable 字符串集合...
标签: c# combobox string-matching