Check if an array contains an invalid value and return false?
<p>This is probably very simple but I guess I haven't had enough of coffee yet.</p>

<p>I have an array with four values and I want to check if any of them is invalid and then set a boolean value to false, else to true.</p>

<pre><code>bool validDecoding = false;
foreach (string decodedValue in arrayOfvalues)
{
    if (decodedValue.Contains("invalid") || decodedValue.Contains("length") || decodedValue.Contains("bad"))
    {
        validDecoding = false;
    }
    else
    {
        validDecoding = true;
    }
}
</code></pre>

<p>But if the last does not contain invalid, length or bad then validDecoding is set to true but I want it to be false if one or more values are invalid.</p>

<p>Please help?</p>

<p>Thanks in advance.</p>
