Hi,
After your dictionary list ready, try this.
Dictionary<string, object> temp = new Dictionary<string, object>();
foreach (Dictionary<string, object> dict in neighborhoodList)
{
if (dict.Keys.First().ToString().StartsWith("a") || dict.Keys.First().ToString().StartsWith("b") || dict.Keys.First().ToString().StartsWith("c") || dict.Keys.First().ToString().StartsWith("d"))
{
temp.Add(dict.Keys.First().ToString(),dict.Values.First().ToString());
}
}
var items = from pair in temp
orderby pair.Key ascending
select pair;
neighborhoodList = new List<Dictionary<string, object>>();
foreach (KeyValuePair<string, object> pair in items)
{
temp = new Dictionary<string, object>();
temp.Add(pair.Key, pair.Value);
neighborhoodList.Add(temp);
}
It would be more simple if you store value in simple dictionary object, not in list of dictionary. Because you can store multiple value in simple dictionary object.
Hope it helps you.
Thanks.