I have added data to a list like this.
List<CommonSearch> regionList = new List<CommonSearch>();
foreach(var items in filteredRegion)
{
regionList.Add(new CommonSearch
{
Destination = returnRegionName(items),
regCde = items
});
}
now I want to add initial data for this.like below to show in my dropdownlist.how can I do that.
//regionList.Insert(0,"All");
Insert into regionList
new CommonSearch
item after foreach
loop:
regionList.Insert(0, new CommonSearch() { Destination = "All" });
Your insert code won't work because of type mismatch in your list.