When I use a hard coded "4" in the second if, it works. But I have a dynamic string[] ProfileArray and want to check, if the value of View08ListBox1Item contains/not contains with one of the strings in ProfileArray. Why it does not work, when I change the "4" against the string[] ProfileArray?
global:
static string[] ProfileArray;
case "Profile":
foreach (ListItem View08ListBox1Item in View08ListBox1.Items)
{
if (View08ListBox1Item.Selected)
{
if (!View08ListBox1Item.Value.ToString().Contains("4"))
{
//:do something
}
else
{
//:do something
}
}
}
break;
this was my first idea, but it does not work:
case "Profile":
foreach (ListItem View08ListBox1Item in View08ListBox1.Items)
{
if (View08ListBox1Item.Selected)
{
if (!View08ListBox1Item.Value.ToString().Contains(ProfileArray))
{
//:do something
}
else
{
//:do something
}
}
}
break;
Contains: it wants astring. An array of strings is not the same thing as a plain-old string.