Home  >  Article  >  php教程  >  var的使用

var的使用

WBOY
WBOYOriginal
2016-07-06 13:30:281342browse

ListEnterPRise epList = ViewBag.epList; foreach (var item in epList){ //todo ... } 当ListEnterprise epList = ViewBag.epList; 变为ListEnterpriseInfo epList = ViewBag.epList; 时, 下面的foreach语句根本不用改变,会加快编码速度.也就是可以简单的

List epList = ViewBag.epList;

foreach (var item in epList){

  //todo ...

}

 

当 List epList = ViewBag.epList; 变为 List epList = ViewBag.epList; 时,

下面的foreach语句根本不用改变,会加快编码速度.也就是可以简单的理解为 var 是类型的变量(本质是类型推断).

 


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn