我如何转换IDictionary<Guid,string>
到IEnumerable<SelectListItem>
?
我想使用字符串 SelectListItem
.
最佳答案
如果你想使用guid作为值,你可以使用
dictionary.Select(x => new SelectListItem { Text = x.Value, Value = x.Key })
关于c# - 将 IDictionary<Guid,string> 转换为 IEnumerable<SelectListItem>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21630446/