Cells c=new Cells();
List<Cells> r=new List<Cells>();
radd(c);
List<List<Cells>> list = new List<List<Cells>>();
listadd(r);
如果我说的符合你的要求,就给我分吧。- -List是一个接口,ArrayList是实现List接口的类,ArrayList的定义如下:
public class ArrayList<E> extends AbstractList<E>
implements List<E>, RandomAccess, Cloneable, javaioSerializable
看出来了吗?ArrayList<E>是implements List<E>的,所以使用一个List接口的引用指向一个ArrayList类的对象,两者泛型类型自然必须保持一致。public IList<AreaModel> GetTailInArea(int employeeId, int agentId)
{
StringBuilder strSQL = new StringBuilder();
strSQLAppend("SELECT AName AS AreaName1, Area1, Area2, BName AS AreaName2 ");
strSQLAppend("FROM T_Area_Tail ");
strSQLAppend("LEFT OUTER JOIN T_Area_List A ON AId = Area1 ");
strSQLAppend("LEFT OUTER JOIN T_Area_List B ON BId = Area2 ");
strSQLAppend("WHERE EmployeeId=@EmployeeId AND AgentId=@AgentId ");
strSQLAppend("ORDER BY T_Area_TailArea1");
IList<AreaModel> list = new List<AreaModel>();
SqlParameter[] parms = {
new SqlParameter("@EmployeeId", SqlDbTypeInt, 4),
new SqlParameter("@AgentId", SqlDbTypeInt, 4)
};
parms[0]Value = employeeId;
parms[1]Value = agentId;
using (SqlDataReader dr = SqlHelperExecuteReader(ConfigHelperConnectionString, CommandTypeText, strSQLToString(), parms)) {
while (drRead()) {
AreaModel item = new AreaModel();
itemArea1 = dr["Area1"]ToString();
itemArea2 = dr["Area2"]ToString();
itemName = dr["AreaName1"]ToString();
itemName2 = dr["AreaName2"]ToString();
listAdd(item);
}
}
return list;
}
看完这个你就会的!类似的
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)