I have an object
class foo {
public int bar;
public string s;
}
that is in a dictionary
Dictionary<String, foo> mm = new Dictionary<String, foo>();
And I want to implmeent a method using LINQ to get all values of the dictonary and return a list of all the “bar” variables. I figure this should be easy using linq, but i’ve not managed to fina relevant example.
public int[] getList() {
return mm.Values.bar <- something like that but with linq
}
You can use
Enumerable.SelectandToArray():