ConcurrentDictionary<webresponse,>> parallelPostsDictionary = new ConcurrentDictionary<webresponse,>>();
List<webpost> highlitedlist = new List<webpost>();
List<webpost> normallist = new List<webpost>();
foreach (var key in parallelPostsDictionary.Keys)
{
List<webpost> result = null;
parallelPostsDictionary.TryGetValue(key, out result);
if (key.highlighted)
{
highlitedlist.Add(result.ElementAt(0));
result.RemoveAt(0);
}
normallist.AddRange(result);
}
highlitedlist = highlitedlist.OrderByDescending(x => x.created_time).ToList();
normallist = normallist.OrderByDescending(x => x.created_time).ToList();
fb_Posts.AddRange(highlitedlist);
fb_Posts.AddRange(normallist);
Cache.Add<list><webpost>>(cacheKey, fb_Posts, expiryTime);