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 Query
- LINQ and Activator.CreateInstance() creates duplicates
- Convert list to dictionary using linq and not worrying about duplicates
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- LINQ Source Code Available
- Refactor Linq code and "LINQ to Entities does not recognize the method"
- How can I code an outer join using LINQ and EF6?
- Using LINQ to remove duplicates in dictionary and the count of those duplicates
- C# - Linq optimize code with List and Where clause
- IEqualityComparer and Linq Distinct - Hard Code GetHashCode()
- creating Linq to sqlite dbml from DbLinq source code
- Stubbing Code for Test With Linq Expressions and Lambdas
- linq sql find duplicates but take null and empty string as the same
- LINQ Remove duplicates and result item to have sum of quantities
- SQL subquery result in LINQ and Entity Framework Code First
- group and count duplicates to a dictionary with linq
- Comparing collections and counting duplicates using LINQ and C#
- Code Rewite for tuple and if else statements by using LINQ
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- C# linq remove duplicates from the top and bottom of the list and keep the duplicates in the middle
- Unable to sort and remove duplicates in LINQ C#
- LINQ to iterate through IEnumerable and set duplicates to null
- Using linq to merge multiple XML files with the same structure and removing duplicates based on a key
- source code for LINQ 101 samples
- Linq lazy loading, (EF Code first, Web.API and MVC)
- C# LINQ code for two list compare and replace
- linq query to filter textvalue pair and remove duplicates by value
- Listview, remove duplicates using LINQ and based in subitem comparing
- Take max date row from duplicates and remove duplicates in the list using linq
- LINQ GroupBy Source = A Destination = B or Source = B and Destination = A
- How to remove duplicates from SQLite DB - using ENtity and LINQ
More Query from same tag
- Compare 2 List<string> with a LIKE clause
- LINQ to SQL Join issues with FirstOrDefault()
- MVC error "requires ienumerable instead of list"
- copy chosen properties to object of other type
- Improving SQLite index
- Mapping collection of strings with Entity Framework or Linq to SQL
- Linq add new variable in query
- How do I display 2 foreign keys in a view ASP.NET MVC by using LinQ
- Code Example for Add DateTime and TimeSpan in EF query
- ILookup versus IGrouping
- Sql IN Clause equivalent in Linq
- Filter element node using LINQ in XML
- Find word before specific phrase in string
- Gridview sorting not working with Linq to SQL
- EF Core - LINQ - Assign property to IQueryable<T>
- Linq to SQL DataContext fails to update Enum field in database for inherited objects
- How to Except<> specifing another key? Or faster way to differences two huge List<>?
- One To Many LINQ Joins Across Nested Collections
- Difference between LINQ FirstOrDefault vs. Where(...).FirstOrDefault?
- Optimize Linq in C#
- How do you transform a Linq query result to XML?
- Sort by most recent date and cluster (group) similar titles
- C# Linq Check if INT exists in list of objects
- Linq to XML: can't find exact root in .xml file
- how to convert system.linq.IQueryable<int?> to int?[]
- Add OrderByDescending to Linq statement
- Using ASP.Net, what would be the best control to use in this situation?
- Define a list type into a variable
- Can I use an embedded lambda with the Contains method?
- Retrieve File Names from a folder while new files are being created by other application