title: linq variables to datagridview in c#
body: <p>i have a simple query in Linq which gets the characters group by word length, below is the code</p>
  
  <pre><code>string sentence = "This is sample linq query";
              string[] words =  sentence.Split(' ');
  
              var query = from word in words
                          group word by word.Length into gr
                          orderby gr.Key ascending
                          select new { Length = gr.Key, Words = gr };
  
              foreach (var obj in query)
              {
                  Console.WriteLine("Word of Length: {0}", obj.Length);
                  foreach (string word in obj.Words)
                  {
                      Console.WriteLine("{0}", word);
                  }
                  Console.WriteLine();
              }
  </code></pre>
  
  <p>it works properly, now i want to convert this into the windows form application by placing the above records into DataGridView, so i implemented like below.</p>
  
  <pre><code>string sentence = "This is sample linq query";
              string[] words = sentence.Split(' ');
  
              var query = from word in words
                          group word by word.Length into gr
                          orderby gr.Key ascending
                          select new { Length = gr.Key, Words = gr };
  
  
              dataGridView1.DataSource = query.ToList();
  </code></pre>
  
  <p>but here i just gets first coluumn (Length) in the DataGridView and not Words column, is there anything else i need to do to get both columns.</p>