Ce code renvoie un ensemble variable de champs et je veux revenir un fortement typé <E>
:Étant donné un <E> générique comment créer un nouvel E et le retourner?
public IList<E> Get(Expression<Func<E, object>> selectLambda == null)
{
if (selectLambda == null)
selectLambda = p => p;
var partialSet = DC.CreateQuery<E>("[" + typeof(E).Name + "]");
foreach (var record in partialSet)
{
var tempEntity = new E(); // This is the error
MapIt(record, tempContract);
result.Add(tempContract);
}
return result;
}
Duplicata de http://stackoverflow.com/questions/840261/c-generic-new-constructor-problem ...? – JeffFerguson