Search dictionary values and return List of keys meeting conditions

Viewed 5461

I've got a problem searching a Dictionary looking like this.

Dictionary<string, string[]> dic = new Dictionary<string, string[]>(){
    {"a", new string[](){"a_val","2"}},
    {"b", new string[](){"b_val","1"}},
    {"b", new string[](){"b_val","0"}}
};

I need to return a List of the Keys where the value of the stingArray[1] element is bigger than "1" like:

List<string> list = new List<string>{
    "a"
};

Because I'm not really good at using LINQ, my current solution is iterating over the Dictionary and adding the keys to a new list. But that method looks ugly and I'm trying to find another solution to the problem.

2 Answers
Related