title: Why is the internal keyword used in this example from Jon Skeet's book?
body: <p>I've been trying to understand the <code>internal</code> keyword and when I need to use it. Fortunately, today, as I'm reading in Jon Skeet's book <em>C# In Depth, 3rd Edition</em> about how to implement iterators, on p.161-162 there is a use for <code>internal</code>: </p>
  
  <p><strong>Listing 6.32</strong></p>
  
  <pre><code>using System;
  using System.Collections;
  
  public class IterationSample : IEnumerable
  {
      object[] values;
      int startingPoint;
  
      public IterationSample(object[] values, int startingPoint)
      {
          this.values = values;
          this.startingPoint = startingPoint;
      }
  
      public IEnumerator GetEnumerator()
      {
          throw NotImplementedException();
      }
  }
  </code></pre>
  
  <p><strong>Listing 6.3</strong></p>
  
  <pre><code>class IterationSampleIterator : IEnumerator
  {
      IterationSample parent;
      int position;
  
      internal IterationSampleIterator(IterationSample parent)
      {
          this.parent = parent;
          position = -1;
      }
  
      public bool MoveNxt()
      {
          if (position != parent.values.Length)
          {
              position++'
          }
          return position &lt; parent.values.Length;
      }
  
      public object Current
      {
          get 
          {
              if (position == -1 ||
                  position == parent.values.Length)
              {
                  throw new InvalidOperationException();
              }
              int index = position + parent.startingPoint;
              index = index % parent.values.Length;
              return parent.values[index];
          }
      }
  
      public void Reset()
      {
          position = -1;
      }
  }
  </code></pre>
  
  <p>So why <code>internal IterationSampleIterator</code>? As I understand, <code>internal</code> is usually in place of <code>public</code>; so help me understand why <code>public IterationSampleIterator</code> could cause problems that are solved by replacing <code>public</code> with <code>internal</code>. </p>