fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. Func<T1, R> then<T1,T2,R>(this Func<T1, T2> f, Func<T2, R> g)
  6. {
  7. return (x) => g(f(x));
  8. }
  9.  
  10. public static void Main()
  11. {
  12. Func<int,int> f = (x) => (x * 2);
  13. Func<int,int> g = (y) => (y + 10);
  14. Func<int,int> h = f.then(g);
  15. System.Console.WriteLine(h(10));
  16. }
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(14,27): error CS1061: Type `System.Func<int,int>' does not contain a definition for `then' and no extension method `then' of type `System.Func<int,int>' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/gac/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty