Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.21 KB | None | 0 0
  1. // source code
  2. public class Range {
  3.     public IEnumerable<int> Count( int start, int end ) {
  4.         for( int i = start; i <= end; i++ ) {
  5.             yield return i;
  6.         }
  7.         yield break;
  8.     }
  9. }
  10.  
  11.  
  12. // compiler-generated code
  13. public class Range
  14. {
  15.     // Methods
  16.     public IEnumerable<int> Count(int start, int end)
  17.     {
  18.         return new <Count>d__0(-2) { <>4__this = this, <>3__start = start, <>3__end = end };
  19.     }
  20.  
  21.     // Nested Types
  22.     [CompilerGenerated]
  23.     private sealed class <Count>d__0 : IEnumerable<int>, IEnumerable, IEnumerator<int>, IEnumerator, IDisposable
  24.     {
  25.         // Fields
  26.         private int <>1__state;
  27.         private int <>2__current;
  28.         public int <>3__end;
  29.         public int <>3__start;
  30.         public Range <>4__this;
  31.         private int <>l__initialThreadId;
  32.         public int <i>5__1;
  33.         public int end;
  34.         public int start;
  35.  
  36.         // Methods
  37.         [DebuggerHidden]
  38.         public <Count>d__0(int <>1__state)
  39.         {
  40.             this.<>1__state = <>1__state;
  41.             this.<>l__initialThreadId = Thread.CurrentThread.ManagedThreadId;
  42.         }
  43.  
  44.         private bool MoveNext()
  45.         {
  46.             switch (this.<>1__state)
  47.             {
  48.                 case 0:
  49.                     this.<>1__state = -1;
  50.                     this.<i>5__1 = this.start;
  51.                     while (this.<i>5__1 <= this.end)
  52.                     {
  53.                         this.<>2__current = this.<i>5__1;
  54.                         this.<>1__state = 1;
  55.                         return true;
  56.                     Label_004B:
  57.                         this.<>1__state = -1;
  58.                         this.<i>5__1++;
  59.                     }
  60.                     break;
  61.  
  62.                 case 1:
  63.                     goto Label_004B;
  64.             }
  65.             return false;
  66.         }
  67.  
  68.         [DebuggerHidden]
  69.         IEnumerator<int> IEnumerable<int>.GetEnumerator()
  70.         {
  71.             Range.<Count>d__0 d__;
  72.             if ((Thread.CurrentThread.ManagedThreadId == this.<>l__initialThreadId) && (this.<>1__state == -2))
  73.             {
  74.                 this.<>1__state = 0;
  75.                 d__ = this;
  76.             }
  77.             else
  78.             {
  79.                 d__ = new Range.<Count>d__0(0) {
  80.                     <>4__this = this.<>4__this
  81.                 };
  82.             }
  83.             d__.start = this.<>3__start;
  84.             d__.end = this.<>3__end;
  85.             return d__;
  86.         }
  87.  
  88.         [DebuggerHidden]
  89.         IEnumerator IEnumerable.GetEnumerator()
  90.         {
  91.             return this.System.Collections.Generic.IEnumerable<System.Int32>.GetEnumerator();
  92.         }
  93.  
  94.         [DebuggerHidden]
  95.         void IEnumerator.Reset()
  96.         {
  97.             throw new NotSupportedException();
  98.         }
  99.  
  100.         void IDisposable.Dispose()
  101.         {
  102.         }
  103.  
  104.         // Properties
  105.         int IEnumerator<int>.Current
  106.         {
  107.             [DebuggerHidden]
  108.             get
  109.             {
  110.                 return this.<>2__current;
  111.             }
  112.         }
  113.  
  114.         object IEnumerator.Current
  115.         {
  116.             [DebuggerHidden]
  117.             get
  118.             {
  119.                 return this.<>2__current;
  120.             }
  121.         }
  122.     }
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement