[Solved] How to optimize redundant code in c#?
It is not possible to put generic constraint about specific constructor availabilty, so you cannot guarantee inside the method that TDal _dal = new TDal(_connectionString); is possible. I would refactor it then to provide dal externally: public List<TRule> getData<TRule>(TRule perRA, IDal<TRule> dalRA, int acao) { List<TRule> list = new List<TRule>(); try { list = dalRA.getDATA(perRA, … Read more