I am working on C# Win 7.
I need to get a query from a dictionary.
Dictionary<string, myClass> myDict;
public class myClass
{
public int myId;
public Dictionary<string, Dictionary<string, string[]>> Dict1;
}
var query = from myStr in myDict group by myStr.value.myId into g select g;
I got error:
Cannot convert lambda expression to type keyValuePair becasue it is not a delegate type.
Any help would be appreciated.
var query = from myStr in myDict
group myStr by myStr.Value.myId into g // you missed myStr here
select g;
That is required by syntax of query expressions (C# Specification 7.16):
group-clause: group expression by expression
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.