ottenere il seguente errore:C# errore generics: i vincoli per il parametro tipo "T" del metodo ...?
Error 1 The constraints for type parameter '
T
' of method
'genericstuff.Models.MyClass.GetCount<T>(string)
' must match the constraints for type
parameter 'T
' of interface method 'genericstuff.IMyClass.GetCount<T>(string)
'. Consider
using an explicit interface implementation instead.
Classe:
public class MyClass : IMyClass
{
public int GetCount<T>(string filter)
where T : class
{
NorthwindEntities db = new NorthwindEntities();
return db.CreateObjectSet<T>().Where(filter).Count();
}
}
Interfaccia:
public interface IMyClass
{
int GetCount<T>(string filter);
}
hey Dutchie goed uomo – user603007
Er lopen hier migliore wat Nederlanders rond inderdaad! :) –
hier in OZ wat minder :) grazie comunque – user603007