fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Reflection;
  6.  
  7.  
  8. public class ABC
  9. {
  10. public int Value { get; private set; }
  11. }
  12.  
  13. internal class Program
  14. {
  15. static void Main()
  16. {
  17. Expression<Func<ABC, int>> expr = abc => abc.Value;
  18.  
  19. Console.WriteLine(((expr.Body as MemberExpression).Member as PropertyInfo).Name);
  20. Yoba(5).ToList().ForEach(Console.WriteLine);
  21. }
  22.  
  23. private static IEnumerable<int> Yoba(int x)
  24. {
  25.  
  26. foreach (var v in Enumerable.Range(3, 9))
  27. {
  28. yield return v;
  29. }
  30.  
  31.  
  32.  
  33. }
  34. }
  35.  
Success #stdin #stdout 0.04s 37216KB
stdin
Standard input is empty
stdout
Value
3
4
5
6
7
8
9
10
11