score:2
Accepted answer
it is working if you force the cast of the dynamic to double instead of letting the .todouble
method find the appropriate type itself. instead, do an explicit cast:
for(var i = 0; i < result.count; i++)
cumulativeavg.add(result.take(i + 1).average(r => (double)r.mydouble));
Source: stackoverflow.com
Related Query
- Linq average of dynamic double
- LINQ Source Code Available
- How to dynamic add filters to a LINQ query against an Odata Source in C#
- creating Linq to sqlite dbml from DbLinq source code
- Dynamic "Not" by parameter in LINQ (Or any other code for that matter)
- Make access possible to dynamic table LINQ EF6 Code First
- source code for LINQ 101 samples
- Linq query dynamic where double
- c# Linq or code to extract groups from a single list of source data
- Entity Framework dynamic linq where from generic source with dynamic where clause
- Dynamic Linq query with multiple Where Average
- Linq dynamic having issue with double quote
- Dynamic LINQ OrderBy on IEnumerable<T> / IQueryable<T>
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Linq code to select one item
- How to use LINQ with dynamic collections
- Dynamic WHERE clause in LINQ
- LINQ : Dynamic select
- How are people unit testing code that uses Linq to SQL
- Get Average Using LINQ
- How to use "contains" or "like" in a dynamic linq query?
- Dynamic LINQ - Is There A .NET 4 Version?
- jqgrid with asp.net webmethod and json working with sorting, paging, searching and LINQ -- but needs dynamic operators
- Strongly typed dynamic Linq sorting
- Calculating Weighted Average with LINQ
- How do you add dynamic 'where' clauses to a linq query?
- Average extension method in Linq for default value
- Dynamic + linq compilation error
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
More Query from same tag
- combining between scripts
- Not able to access a element using LINQ and XDocument
- VB.NET LINQ To DataTable Select with Where Clause
- Is there a way to use over with order by clause in linq?
- LINQ expression trees
- RavenDB: Search with whitespace, behaving like String.Contains
- LINQ Group By (VB.net & Linq to Entities)
- Trying to fit a Distinct() into a relatively complex LINQ query
- How to take driver id column using this linq query
- Does "Select New" in linq trigger an evaluation / load?
- Error: Both DataSource and DataSourceID are defined on 'GridView2'. Remove one definition.?
- ReactiveUI "Compelling Example" search with Caliburn.Micro.ReactiveUI
- Join and group 2 lists with common key
- Sum Node values using LINQ to XML
- Having problems with a Lambda LINQ Query
- LINQ Select First
- Converting SQL statement using SUM() to Linq/Entity Framework
- LINQ anonym object with result to delimited string (LINQ to Entities does not recognize the method 'System.String ToString()' method)
- Returning a single property of a Model in HttpGet Method in ASP.NET Core Web API
- How to search for FirstName + Lastname from sql data base when input is full name with entities in c#?
- Linq pivot indicator values into additional columns and aggregate data
- Get latest previous year if possible
- How do I properly use distinct and compare?
- LINQ query: Dynamically add Includes at run time
- Listing in WCF Entity
- Unable to add item to dataset in Linq to SQL
- Creating a map from property names to types with that property
- How to override the Linq select statement?
- Check LINQ return is null for observable collection List
- LINQ to SQL Group By Multiple Records in One Row