关于接口的问题?
PetShop中有这样一个函数:
public static IList GetProductsByCategory(string category) {
IList productsByCategory = new ArrayList();
...
return productsByCategory;
}
问题:
1、为什么函数要返回IList接口而不直接返回ArrayList,除了接口对外的样子很一致的原因外,是否还有其它原因,如接口更轻量级?
2、我发现一般IList和ICollection用得较多,是否还有其它用得较多的地方和其它的接口,如System.Collection下的接口之类?
多谢!