private bool HadErrorOrWarning(string matchStr, List<string> list) { if (matchStr == null) return list.Count > 0; foreach (var str in list) { if (str.Contains(matchStr)) return true; } return false; }