1 //控制器 2 public List<string> ReadFiles(string filePath) 3 { 4 List<string> list = new List<string>(); 5 ..... 6 //返回list 7 return View(list); 8 } 9 10 //View 遍历 11 @model List<string> 12 @if (Model != null) 13 { 14 foreach (var item in Model) 15 { 16 <ul> 17 <li class="data-list" data-filename="@item">@item</li> 18 </ul> 19 } 20 }