Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Razor 中有 foreach 循环,它遍历group by-ed 元素,所以每个元素都必须有一个 Key 属性,但它会抛出异常:
group by
'object' does not contain a definition for 'Key'
尝试将循环更改为
foreach(IGrouping<T1, T2> g in ViewBag.Links) { ... }
替换分组键和值的实际类型。