fork download
  1. using System;
  2.  
  3. class Demo
  4. {
  5. public static void Main()
  6. {
  7. int factor = 2;
  8.  
  9. Func<int,int> multiplicador = delegate (int n) { return n * factor;};
  10.  
  11. factor = 10;
  12.  
  13. // Usa el valor actualizado de la variable `factor`:
  14. Console.WriteLine (multiplicador(3));
  15. }
  16. }
Success #stdin #stdout 0.03s 34712KB
stdin
Standard input is empty
stdout
30