【发布时间】:2015-03-25 18:52:24
【问题描述】:
if (!lstFieldData.Items.Contains(ItemValue))
MessageBox.Show(ItemValue + "Item not found.");
上面的代码是获取不在列表中的项目的列表。 现在我想通过忽略案例来检查这一点。我该怎么做?
【问题讨论】:
-
不.. 这是列表。我的问题是针对 ListBox 的。
-
@DDave - 答案是一样的。否则,您尝试过/研究过什么?
-
@Sayse 不是真的。它需要 Enumerable 对象。是不是。我也试过了。
-
ListBox.Items是 IEnumerable -
这对我有用...thanx all if (!lstFieldData.Items.Cast
().ToList().Contains(ItemValue,StringComparer.InvariantCultureIgnoreCase))