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 Articles
- 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()
- Entity Framework - how to merge child collections? (Best Practices)
- LINQ Issue: Unable to cast object of type 'System.Reflection.Module' to type 'System.Reflection.Emit.ModuleBuilder
- Looping through List values in C# and saving them to a CSV
- Call function inside linq query
- Prevent Duplicates From Being Saved In Database
- How to implement a Linq NullCheck Expression?
- Adding a large amount of records using LINQ
- how to check if key exists before adding in to dictionary
- Check if a Linq IQueryable has an order by applied
- EF using Wrong String.Concat
- How do I pick out values between a duplicate value in a collection?
- LEFT JOIN in LINQ to entities?
- How to convert List<Dapper.SqlMapper.FastExpando> to runtime type (List<IDictionary<string,object>>)
- Error in Linq Query when using anonymous return on List
- Should I consider LINQ to Entities?
- how can i create a programmatically sort order in C# on a grouped collection
- LINQ To SQL - Poor Sql Performance
- linq count error: DbExpressionBinding requires an input expression with a collection ResultType. Parameter name: input
- Updating a SQL table through DataGrid in WPF - I cannot get the updated data from the datagrid
- Read element from SOAP message