score:1
Accepted answer
The LINQ expression indicators
will be re-evaluated every time you call GetEnumerator
. You need to force a single evaluation by invoking ToList
or ToArray
. This could of course result in memory space issues if you are expecting many indicators.
Source: stackoverflow.com
Related Articles
- LINQ Source Code Available
- LINQ and Activator.CreateInstance() creates duplicates
- creating Linq to sqlite dbml from DbLinq source code
- source code for LINQ 101 samples
- c# Linq or code to extract groups from a single list of source data
- C# LINQ find duplicates in List
- Remove duplicates in the list using linq
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Convert list to dictionary using linq and not worrying about duplicates
- Linq code to select one item
- How to Count Duplicates in List with LINQ
- How are people unit testing code that uses Linq to SQL
- How to remove duplicates from collection using IEqualityComparer, LinQ Distinct
- Using LINQ to find duplicates across multiple properties
- removing duplicates in a list with linq
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Remove duplicates while merging lists using Union in LINQ
- Syntax to execute code block inside Linq query?
- LINQ to Nhibernate duplicates joins
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- Best open source LINQ provider
- Using Linq to find duplicates but get the whole record
- Is there a good source that gives an overview of linq optimizations?
- LinQ distinct with custom comparer leaves duplicates
- Does this LINQ code perform multiple lookups on the original data?
- How to understand the following C# linq code of implementing the algorithm to return all combinations of k elements from n
- LINQ WHERE method alters source collection
- C# Linq Find duplicates with multiple group by
- Where can I view LINQ source code?
- Comparing against child property in generic/dynamic linq predicate with reflection
- Error 1 Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?)
- Aggregate results into Named Type
- Sorting in Linq by constructing the linq statement as a string?
- linq getting datarow and iterating each field based on Column
- When we use FirstOrDefault(x => x.Id == obtId || x.Id == pagId) which condition does it evaluate
- LINQ to Entities result not being sorted right
- How do I write this as non-LINQ code?
- Converting a Predicate<T> to a Func<T, bool>
- Lambda Func delegate using interface
- Search function LINQ. Use checkbox values as parameters
- Cross apply two list, return same modified object
- Why Does IQueryable Select Has Invalid Arguments With DTO but works with object?
- Sort a C# list by word
- IQueryable optional OrderBy with PredicateBuilder and Entity Framework
- Get data for current month using Linq - VB
- for in for optimization
- C# Linq, find lowest value in List<int> between two numbers
- Get substring of field using EF and SQL Server
- Linq how to union array of objects inside list and group by value