List lstResult = new List();
List> lstProjectCount = new List>();
lstProjectCount = objClient.GetProjectCounter();
if (lstProjectCount != null)
{ Dictionary dicResult = new Dictionary();
dicResult = lstProjectCount.ToDictionary(dicResult);
foreach (var k in dicResult)
{
objProCount = new ProjectCounterEntities();
objProCount.ProjectState = (ProjectStateEnumUI)k.Key;
objProCount.ProjectCount = k.Value;
lstResult.Add(objProCount);
}
return lstResult; } I want to retrive value with respact to key , and want to map the value and key both into the DTO List, where ProjectCounterEntities is a DTO and the members of this DTO are "ProjectState" and "Count".
The output of List will be
ProjectState Count
------------------------
projectstate1 2
Projectstate2 5
ProjectState3 6
Replies
Know the answer? Post it — somebody with the same question will find it here.