निम्न त्रुटि हो रही है:सी # जेनेरिक त्रुटि: विधि के प्रकार पैरामीटर 'टी' के लिए बाधाएं ...?
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.
कक्षा:
public class MyClass : IMyClass
{
public int GetCount<T>(string filter)
where T : class
{
NorthwindEntities db = new NorthwindEntities();
return db.CreateObjectSet<T>().Where(filter).Count();
}
}
इंटरफ़ेस:
public interface IMyClass
{
int GetCount<T>(string filter);
}
हे डिकी ने आदमी को – user603007
एर लोपेन हायर सर्वश्रेष्ठ वाट नेडरलैंडर्स रैंड इंडरडाड! :) –
OZ wat minder में hier :) वैसे भी धन्यवाद – user603007