score:1
you should use 'by new' after 'group'. I hope this will help you.
var entries = from entry in _db.Entries
group entry by new { entry.Name } into groupedByName
select new
{
groupedByName.Key.Name,
NumberOfComments = groupedByName.Count(x => x.Name != null)
};
Source: stackoverflow.com
Related Articles
- linq count error: DbExpressionBinding requires an input expression with a collection ResultType. Parameter name: input
- DbExpressionBinding requires an input expression with a collection ResultType. Parameter name: input
- DbExpressionBinding requires an input expression with a collection ResultType
- DbExpressionBinding requires an input expression LINQ
- Linq projection :DbExpressionBinding requires an input expression with a collection ResultType
- LINQ with Lambda expression - Join, Group By, Sum and Count
- Convert SQL to linq expression with count
- Linq SQL error with one-to-many relationship and orderby complex expression
- Help with Linq expression to return a list of strings based on field count
- Linq expression with multiple input parameters
- Linq in conjunction with custom generic extension method build error - An expression tree may not contain an assignment operator?
- entity framework with linq query and stored expression error
- Error LINQ expression contains references to queries that are associated with different contexts
- The specified LINQ expression contains references to queries that are associated with different contexts error in c#
- LINQ throwing TypeAs expression with input of type 1 and check of type 2 is not supported
- Compiling Error with LINQ Sorting Code Using List<T>
- LINQ expression with mulitple count
- Linq Lambda Error : The specified LINQ expression contains references to queries that are associated with different contexts
- Dynamic Linq Where with Lambda Expression generates Error
- Trouble with a LINQ 'filter' code throwing an error
- Preserve input with LINQ expression using Except instead of Where
- Lambda expression with statement body error in previously working code
- How get max count with min key from list integer with linq written in one expression
- LINQ Expression to Select objects by string property with maximum count of objects in its queue property without duplicates
- The LINQ expression could not be translated - Error with Nullable Id field
- Saved projection expression for re-use in different linq expressions with two source objects
- LINQ Left Outer Join with Group By and Count Producing Error
- "Argument expression is not valid" error with EF4 Linq sub select query
- LINQ with groupby and count
- Linq with group by having count
- Linq Syntax Any()
- Can someone explain Query Reshaping in Linq with the following example?
- Save the result of LINQ query to list
- How to remove a List string element if it contains a string element from another List?
- Lambda Expression to search with conditions and return only 1 latest result
- Is Microsoft going to support SQL Server 2008 with LINQ in Visual Studio 2010?
- Linq Query with join on subquery
- In a Linq Expression body how to use the value of a variable instead of a reference to it?
- Select values from multiple dictionaries into list of objects with LINQ
- Extension to choose which extension to use in Linq
- Translate SQL to linq or lambda in C#
- Prepare dynamic filters
- How can I compare two Lists and create another list where the match?
- Linq way of checking that no items in a collection match any other item
- Query ObservableCollection with Linq MVVM
- Send info to the view from another table with navigation property?
- In C# adding SelectMany extends linq to a new monad type, how do I do the same thing in VB.net?
- Using linq and lambda to filter two collections
- Dynamic Linq: How to specify the StringComparison type?
- Index was out of range when expression converted to linq expression