Presenting EnumerableHelper

I noticed (eg: here) that i’m not the only one that has experienced some annoyances when working with generics. Here are a couple of methods that i find extremely helpful when i’m working with IEnumerable<T>:

IEnumerable<tbase> Convert<tderived, TBase>(IEnumerable<tderived> enumerable) where TDerived : TBase;
IEnumerable<t> Convert<t>(IEnumerable enumerable);
bool HaveSameElements<t>(IEnumerable<t> enumerable1, IEnumerable<t> enumerable2, Func<bool, T, T> areEqual);
bool HaveSameElements(IEnumerable enumerable1, IEnumerable enumerable2, Func<bool, object, object> areEqual);
bool HaveSameElements(IEnumerable enumerable1, IEnumerable enumerable2);

You can download the actual implementation of this Be.Timvw.Framework.Collections.Generic.EnumerableHelper class in BeTimvwFramework.

  1. This introduces a plasiegnly rational point of view.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>