Using the generic type 'Mapper<T>' requires 1 type arguments
<p>I have the following class:</p>

<pre><code>public class Mapper&lt;T&gt; {

  public static Mapper&lt;T&gt; GetFor&lt;TKey&gt;(T type) {
    return new Mapper&lt;T&gt;();
  }

  public static Mapper&lt;T&gt; GetFor&lt;TKey&gt;(IEnumerable&lt;T&gt; types) {
    return new Mapper&lt;T&gt;();
  }  

  public Mapper&lt;T&gt; Add&lt;TKey&gt;(Expression&lt;Func&lt;T, TKey&gt;&gt; expression, String name) {

    _fields.Add(name, expression);
    return this;

  }

}
</code></pre>

<p>I am using a static method as sometimes I need to create a Mapper instance having an anonymous type so I use:</p>

<pre><code>var a = new { /* ... */ }
var b = Mapper.GetFor(a);
</code></pre>

<p>But I get the error:</p>

<pre><code>Using the generic type 'Mapper&lt;T&gt;' requires 1 type arguments
</code></pre>

<p>I also tried the following:</p>

<pre><code>public class MapperFactory {
  public static Mapper&lt;T&gt; CreateMapperFor&lt;T&gt;(IEnumerable&lt;T&gt; typeProvider) {
    return new Mapper&lt;T&gt;();
  }
}

var a = new { /* ... */ }
var b = MapperFactory.CreateMapperFor(a);
</code></pre>

<p>Using the factory class works fine ...</p>

<ol>
<li>How to solve the problem with the first version?</li>
<li>Should I have a method inside Mapper or use a factory?</li>
</ol>

<p>I am doing this simply because I have situations where the type is anonymous.</p>