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.
我正在尝试对返回 SelectList 的函数进行单元测试。
如何从 SelectList 中检索项目以验证我的模型是否正确构建?
mySelectList.Items.First().DataValue
管他呢。
只需使用mySelectList.ElementAt(n)即可获取第 n 个 SelectListItem。
mySelectList.ElementAt(n)