LINQ Group by error: "does not contain a definition for 'GroupBy'"
c#, linq
Solution
Those kinds of errors typically mean you aren't including `System.Linq` in your using list. Try throwing this at the top of your code file:
`using System.Linq;`
Problem
I have a List that I need to group by. In the list I add this object: ``` private class MyObject { private System.Drawing.Color color; private string title; public MyObject(System.Drawing.Color color, string title) { this.color = color; this.title = title; } public string Title { get { return title; } set { title = value; } } public System.Drawing.Color Color { get { return color; } set { color = value; } } } ``` I create my List as: ``` System.Collections.Generic.List<MyObject> mList = new System.Collections.Generic.List<MyObject >(); ``` Then I try to group the content: ``` var groupedList = mList.GroupBy(c => new {c.Title} ).ToList(); ``` And that is when I get the error. Any ideas? How can I do this? Thanks!