System.Collections.IEnumerable extension methods

Each(Action<object> action)

Summary: Performs the specified action on each element in the IEnumerable.
C# Example:
var combinedLength = 0;

var arr = new string[] {
    "Chris", "Steve", "John"
};

arr.Each(d => combinedLength += d.Length);
// combinedLength now equals 14

IsEmpty()

Summary: Returns a boolean indicating if the IEnumerable is Empty.
C# Example:
var arr = new string[0];

if (arr.IsEmpty()) {
    // do something
}

Last edited May 4, 2012 at 2:10 PM by crpietschmann, version 3

Comments

No comments yet.