Wednesday, November 4, 2015

Simple yet effective way to find if IEnumerable has elements or not

bool IsEmpty(IEnumerable en)
{
    foreach(var c in en) { return false; }
    return true;
}

No comments:

Post a Comment