How i can convert IDictionary<Guid,string>
to the IEnumerable<SelectListItem>
?
I want to use string as SelectListItem
.
Well you could just use
dictionary.Values().Select(x => new SelectedListItem { Text = x })
Just be aware that it may not be in a useful order: Dictionary<,>
is inherently unordered (or rather, the order may change and shouldn't be relied on).
See more on this question at Stackoverflow