Convert ListItemCollection i.e. Dropdownlist'Items to a Dictionary

Rajesh_Kumar
Posted by Rajesh_Kumar under C# category on | Points: 40 | Views : 1817
Suppose,i have a dropdownlist called ddl_users which contains list of users.

var result = ddl_users.Items.Cast<ListItem>()
.ToDictionary(item => item.Value,
item => item.Text,StringComparer.OrdinalIgnoreCase);

Comments or Responses

Login to post response