What you want to do here will not work for two reasons:
- Interfaces cannot have static elements
- . , , .
, , , . , , , , , , .
, , , , Employee. , , Employee . , FirstName, GivePromotion() .. , .
, , , . - . , , . , :
public interface IRepository<T>
{
T GetFromDatabase()
}
:
public class Repository<T> : IRepository<T>
{
T GetFromDatabase()
{
//Your actual code for database retrieval goes here
}
}
, , :
public class EmployeeRepository : IRepository<Employee>
{
Employee GetFromDatabase()
{
//Your actual code for database retrieval goes here
}
}