List<string> Exists Contains

for (int i = 0; i < 7; i++)
            {

if (!listColspan.Exists(delegate(string str){if (str==i.ToString()) return true;else return false;}) )
                {
                    sbDrugSolutionRow.Append("<td>&nbsp;</td>");
                }

}

等效于

for (int i = 0; i < 7; i++)
            {
                if (!listColspan.Contains(i.ToString()))
                {
                    sbDrugSolutionRow.Append("<td>&nbsp;</td>");
                }

}

原文地址:https://www.cnblogs.com/lingxzg/p/2620617.html