Determining if all strings are parsable to int I have to loop through a list of strings and validate that all are parsable to int and not less than 1.  Also, if a string is not parsable but is null or whitespace, then it is OK and my validator should not fail.

Here's the code I have come up with which works fine but leads to method complexity:

public static bool ArePerPersonBILimitsInvalid(IEnumerable&lt;string&gt; bilimits)
        {
            return bilimits.Any(c =&gt;
            {
                int d;
                if (!int.TryParse(c, out d))
                {
                    if (string.IsNullOrWhiteSpace(c))
                    {
                        return false;
                    }

                       return true;
                }

                if (d &lt; 1)
                {
                    return true;
                }

                return false;
            });
        }
I find that negatives in method names lead to confusing code. For instance,

if (!ArePerPersonBILimitsInvalid(...))



  "Are there no BI limits that are invalid?"


becomes much more readable when we write it this way:

if (ArePerPersonBILimitsValid(...))



  "Are all BI limits valid?"


So let's fill in the blanks.

public static bool ArePerPersonBILimitsValid(IEnumerable&lt;string&gt; biLimits)
{
    return biLimits.All(IsBILimitValid);
}


Great, so now we need to write IsBILimitValid.

public static bool IsBILimitValid(string biLimit)
{
    if (string.IsNullOrWhiteSpace(biLimit))
    {
        return true;
    }

    int value;
    return int.TryParse(biLimit, out value) &amp;&amp; value &gt;= 1;
}


This way the code much more closely reflects your problem statement:


  loop through a list of strings and validate that all are parsable to
  int and not less than 1