Ankit  Shukla

Ankit Shukla

  • NA
  • 681
  • 110.8k

LINQ QUERY

Jul 14 2015 12:34 AM
Hello,
 
     I am new in LINQ. There is a query given below. I want to know that what is the meaning of  'into g' in 2nd line and 'g.key' in 4th line. 
 
 
//To achieve Select CategoryId, Count(CategoryID) As FieldName From ProductMst Group By CategoryId you need
to write follofing linq Query
var Result14 = from p in db.ProductMst
group p by p.CategoryID into g
select new {
CategoryId = g.Key,
FieldName = g.Count()
};

Answers (5)