1
I have a array of strings
:
string[] warnings =
{
"INQUIRY REQUEST",
"ITEM ALREADY EXISTS",
"ITEM NOT FOUND",
"END OF FILE",
};
and I have a variable with the following value:
status = " 18:46:24:97 INQUIRY REQUEST ";
It arrives with blank spaces and with the time at the beginning. I confirm if the value assigned to this variable is contained within the array in this way:
if (warnings.Any(warning => warning.Contains(status.Trim())))))
{
// Code here
}
else
{
// Code here
}
But the condition falls on else
even if it contains "INQUIRY REQUEST" within the variable status
. How can I correct or improve this condition of if
?