本文介绍了泛型类与非泛型类的区别有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里有两个类:
class ProductProcessor { public Product ExtendName(Product p) { p.name = p.name + " The product"; return p; } } class ProductProcessor<T> where T : Product { public T ExtendName(T p) { p.name = p.name + " The product"; return p; } }如果两个类都没有性能损失,那么泛型类的优势是什么?
what is the advantage of the generic class given that both classes have no performance penalties?
推荐答案
www.codeproject/Articles/814768/CRUD- Operations-Using-the-Generic-Repository-Patte
www.codeproject/Articles/814768/CRUD-Operations-Using-the-Generic-Repository-Patte
通用存储库就是这样一种用法。
The generic Repository would be such a usage.
更多推荐
泛型类与非泛型类的区别有什么区别?
发布评论