Check if a Windows ListBox contains a string c# ignorecase?
This question already has an answer here:
如果您的lstFieldData只包含大写字母或小写字母,则可以使用.ToUpper()或.ToLower()。
lstFieldData
A
B
C
D
if (!lstFieldData.Items.Contains(ItemValue.ToUpper()))
MessageBox.Show(ItemValue + "Item not found.");
lstFieldData
a
b
c
d
if (!lstFieldData.Items.Contains(ItemValue.ToLower()))
MessageBox.Show(ItemValue + "Item not found.");
if (strCompare.Equals("testcompare", StringComparison.InvariantCultureIgnoreCase))
{
///
}
尝试这个
链接地址: http://www.djcxy.com/p/13092.html上一篇: LINQ中不敏感的字符串匹配在哪里