Journeyman
Journeyman

Reputation: 10271

Convert System.Collections.Generic.SortedList<string,T> into IEnumerable<T>

What is the most efficient way to convert a

System.Collections.Generic.SortedList<string,Contact>

into a

IEnumerable<Contact>

The consumer of IEnumerable is an MVC view which will want to display the items in the order in which they were stored in System.Collections.Generic.SortedList

Upvotes: 1

Views: 747

Answers (1)

Jeffrey Zhao
Jeffrey Zhao

Reputation: 5023

SortedList.Values or SortedList.GetValueList (only in the non-generic version) is just what you need.

Upvotes: 7

Related Questions