fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. class Animal
  5. {
  6. public string Name;
  7.  
  8. public bool DoIt()
  9. {
  10. Console.WriteLine(this.Name);
  11. return true;
  12. }
  13. }
  14.  
  15. class Magic
  16. {
  17. Animal a = (from x in Enumerable.Repeat(new Animal() { Name = "Слон" }, 1) where x.DoIt() select x).First();
  18. }
  19.  
  20. public class Test
  21. {
  22. public static void Main()
  23. {
  24. new Magic();
  25. }
  26. }
Success #stdin #stdout 0.03s 23960KB
stdin
Standard input is empty
stdout
Слон