title: iterator parameter in generics function C#
body: <p>I would like to do a convertAll generic a function like </p>
  
  <pre><code>public static Iout ConvertAll&lt;Iin, Iout, T, TOutput&gt;(this Iin source, Converter&lt;T, TOutput&gt; converter)
          where Iin : IEnumerable&lt;T&gt;
          where Iout : IEnumerable&lt;TOutput&gt;
      {
          foreach (var item in source)
              yield return converter(item);
      }
  </code></pre>
  
  <p>The problem is that visual studio tell me :</p>
  
  <blockquote>
    <p>The body of 'Sgd.CollectionExtensions.ConvertAll(Iin, System.Converter)' cannot be an iterator block because 'Iout' is not an iterator interface type</p>
  </blockquote>
  
  <p>the things is I have the where clause so it should be recognize like an iterator, isn't ?</p>
  
  <p>i also try :</p>
  
  <pre><code>public static I&lt;TOutput&gt; ConvertAll&lt;I, T, TOutput&gt;(this I&lt;T&gt; source, Converter&lt;T, TOutput&gt; converter)
          where I : IEnumerable
      {
          foreach (var item in source)
              yield return converter(item);
      }
  </code></pre>
  
  <p>but it says </p>
  
  <blockquote>
    <p>The type parameter 'I' cannot be used with type arguments</p>
  </blockquote>
  
  <p>so i don't know what to do.
  i don't want a function like :</p>
  
  <pre><code>public static IEnumerable&lt;TOutput&gt; ConvertAll&lt;T, TOutput&gt;(this IEnumerable&lt;T&gt; source, Converter&lt;T, TOutput&gt; converter)
      {
          foreach (var item in source)
              yield return converter(item);
      }
  </code></pre>
  
  <p>it's much simpler and it's working but it return a IEnumerable an i want the same kind of iterator in output that i have in input </p>
  
  <p>Hope you can help me 
  Thanks </p>