Generic extension method returning IEnumerable<T> without using reflection
- by roosteronacid
Consider this snippet of code:
public static class MatchCollectionExtensions
{
public static IEnumerable<T> AsEnumerable<T>(this MatchCollection mc)
{
return new T[mc.Count];
}
}
And this class:
public class Ingredient
{
public String Name { get; set; }
}
Is there any way to magically transform a…