title: 'Yield' in either IEnumerator or IEnumerable?
body: <p>I've been Searching for this point and i do not get any information about it yet!. </p>
  
  <p>I Saw a lot a videos and red bunch of articles about 'Yield Return' and i think i've better understanding about it but there is a point I can't get it</p>
  
  <p>What is the Correct interface should i use yield return into it ? (of Course  Yield return will be used in Loop but in which interface).</p>
  
  <p>I mean there is variation in this point, I saw some of people creating an <strong>"iterator"</strong> within <code>IEnumerator</code>, for example :</p>
  
  <pre><code>static string[] Names = { "Name1", "Name2", "Name3" };
  
      static IEnumerator Test()
      {
          for (int i = 0; i &lt; Names.Length; i++)
          {
              yield return Names[i];
          }
      }
  </code></pre>
  
  <p>and Some others use <code>IEnumerable</code> : </p>
  
  <pre><code>        static IEnumerable Test()
      {
          for (int i = 0; i &lt; Names.Length; i++)
          {
              yield return Names[i];
          }
      }
  </code></pre>
  
  <p>I'm assuming it's better to Create an "Iterator" using "Yield return" within<code>IEnumerable</code> interface, because In general IEnumerable responsible of having access to the class (to be more accurate, it returns an instance of the class(Object)) that defend the Logic of iteration. and which exactly what happen by the compiler (the sugar of yield Keyword) in this case.</p>
  
  <pre><code> private static IEnumerable Test() =&gt; new &lt;Test&gt;d__1(-2);
  //decompiled code of Test() method above Using reflector tool
  </code></pre>
  
  <p>Any Ideas about this ? </p>