using System; public sealed class Thing where TFirst : class { public static Thing Create (Func fn) where TSecond : class { return new Thing ( delegate (TFirst item) { TSecond foo = item == null ? null : fn (item); Console.WriteLine (foo); }); } public void SomeAction () { _fn (null); } private Thing (Action fn) { _fn = fn; } Action _fn; } public static class Program { public static void Main () { var foo = Thing.Create (x => x); foo.SomeAction (); } }