How do we get benefits from generics in the following scenario?
public interface IRepository<T> where T : BaseEntity
{
IEnumerable<T> GetAll();
T Get(long id);
void Insert(T entity);
void Update(T entity);
void Delete(T entity);
}
public interface IRepository
{
IEnumerable<BaseEntity> GetAll();
BaseEntity Get(long id);
void Insert(BaseEntity entity);
void Update(BaseEntity entity);
void Delete(BaseEntity entity);
}
What benefit do we get from first piece of code?