List<Enterprise> epList = ViewBag.epList; foreach (var item in epList){ //todo ... } 當 List<Enterprise> epList = ViewBag.epList; 變為 List<EnterpriseInf
List<Enterprise> epList = ViewBag.epList;
foreach (var item in epList){
//todo ...
}
當 List<Enterprise> epList = ViewBag.epList; 變為 List<EnterpriseInfo> epList = ViewBag.epList; 時,
下麵的foreach語句根本不用改變,會加快編碼速度.也就是可以簡單的理解為 var 是類型的變數(本質是類型推斷).