List<Enterprise> epList = ViewBag.epList;
foreach (var item in epList){
//todo ...
}
当 List<Enterprise> epList = ViewBag.epList; 变为 List<EnterpriseInfo> epList = ViewBag.epList; 时,
下面的foreach语句根本不用改变,会加快编码速度.也就是可以简单的理解为 var 是类型的变量(本质是类型推断).
List<Enterprise> epList = ViewBag.epList;
foreach (var item in epList){
//todo ...
}
当 List<Enterprise> epList = ViewBag.epList; 变为 List<EnterpriseInfo> epList = ViewBag.epList; 时,
下面的foreach语句根本不用改变,会加快编码速度.也就是可以简单的理解为 var 是类型的变量(本质是类型推断).