在Controller的方法参数中使用IEnumerable
例如,假设我们有一个Student模型类:
public class Student { public int Id { get; set; } public string Name { get; set; } }
然后我们想要在Controller中接收一个Student对象列表:
[HttpPost]
public IActionResult CreateStudents(List
上述代码中,我们在CreateStudents方法中使用了List
注意:在此方法中也可以使用IEnumerable