我有一个foreach循环,需要在从中选择最后一项时执行一些逻辑List,例如:
foreach (Item result in Model.Results)
{
//if current result is the last item in Model.Results
//then do something in the code
}
Run Code Online (Sandbox Code Playgroud)
如果不使用for循环和计数器,我可以知道哪个循环是最后的吗?