This is a very nice and clean example:(check this great tutorial for a full explanation link)
public static IEnumerable<SelectListItem> ToSelectListItems(
this IEnumerable<Album> albums, int selectedId)
{
return
albums.OrderBy(album => album.Name)
.Select(album =>
new SelectListItem
{
Selected = (album.ID == selectedId),
Text = album.Name,
Value = album.ID.ToString()
});
}
In this MSDN link you can read de DropDownList
method documentation.
Hope it helps.