title: How do I make a method in a vb generic interface that returns an instance of the implementing class?
body: <p>In Visual Basic, I want to create an interface that includes a function that returns an object of the implementing class. That is</p>
  
  <pre><code>public interface I
    function maker as ???
  end interface
  
  public class X
    implements I
    function maker as X
      return new X()
    end function
  end class
  
  public class Y
    implements I
    function maker as Y
      return new Y()
    end function
  end class
  </code></pre>
  
  <p>Is there a way to say that? I suppose I could always say that <code>maker</code> returns an <code>I</code> rather than an <code>X</code> or a <code>Y</code>, but then callers would have to cast it. I thought of defining the interface as</p>
  
  <pre><code>public interface I(of ii as I)
  </code></pre>
  
  <p>But the whole point in doing this was so I could create a generic class that uses an <code>of I</code>, and if I say that, then the compiler insists on an infinite regression <code>of I(of I(of I...</code></p>