linux-packaging-mono/mcs/tests/test-anon-155.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

35 lines
574 B
C#

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