// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; namespace E { public class Program { public class Foo { } public class Bar { } public static T MinFedeMetode(Func> f) where T: new() { Console.WriteLine(f().Count); return new T(); } public static T MinFedeMetode(Func f) where T: new() { return MinFedeMetode(() => new List { f() }); } public static void Main(string[] args) { MinFedeMetode(() => new List { new Foo(), new Foo() }); MinFedeMetode(() => new Foo() ); } } }