score:3
"the dictionary passed in, is constantly increasing in size"
do you mean that it's being modified while you're executing this code? that's a no-no. i suspect the tolist
call is failing due to this. (after tolist()
has executed, the list should be effectively separate from the dictionary.)
basically dictionary<tkey, tvalue>
doesn't support concurrent reading and writing. you might want to look at concurrentdictionary<,>
which allows you to iterate over it while another thread is writing.
one suggestion to improve performance when it's all working: call side.tostring()
once at the start of the method, instead of on every single loop iteration.
Source: stackoverflow.com
Related Query
- .NET LINQ: Check array index and length EXCEPTION
- How to use Linq to sort an array by Length and then value
- "unrecognized expression node array index linq" exception in LINQ to SQL
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- Converting from Linq byte[] Concat to older .net Array with copy and Length considerations
- Linq code to get the index of an object in an array from an object within a list
- Error when splitting and replacing chars C# email with LINQ Array Index not supported in LINQ
- Join Two Array based on Index and Index Value using Linq Query Expression Syntax
- search an array of string in a large string and check if any exist using linq
- Convert an array to dictionary with value as index of the item and key as the item itself
- Take the first five elements and the last five elements from an array by one query using LINQ
- linq where clause and count result in null exception
- Convert string to int in an Entity Framework linq query and handling the parsing exception
- LINQ Any() and Single() vs. SingleOrDefault() with null check
- Obtaining the min and max of a two-dimensional array using LINQ
- How to get a byte array length using LINQ to Entities?
- Random array using LINQ and C#
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- Using C# Linq to return first index of null/empty occurrence in an array
- Linq group string array by count and sort
- Linq where clause with multiple conditions and null check
- How linq function OrderByDescending and OrderBy for string length works internally? Is it faster than doing it with loop?
- Linq - Get the Index of the Last Non-Zero Number of Array
- LINQ Source Code Available
- Get array index values of the top 1000 largest entries inside an array using LINQ
- Refactor Linq code and "LINQ to Entities does not recognize the method"
- Intermittent Linq FirstOrDefault Error - Index was outside the bounds of the array
- DataTable select with LiNQ and check is there duplicate rows or not
- Linq query, how to check for a null value and use the value 0 in place of a null?
- Linq check for null and replace null value in orderby
More Query from same tag
- LINQ SelectMany returns child instead of a parent in nested filtering
- Translate SQL Query into LINQ Query
- Check if a list contains two elements of different derived types
- Entity Framework - Insert multiple complex objects at once
- Select two columns of similar types in a Linq Query
- Selecting from xml based on attributes in multiple subnodes
- What is the return type of my linq query?
- Using LINQ to group by multiple properties and sum
- Linq to objects very slow compared to dataview
- Is there a more compact/better way to ZIP multiple lists using LINQ in C#?
- C# Best practice (LINQ) for check a string in a List/Array of strings
- Entity Framework returns wrong data after execution of two similar queries
- Build an lambda Expression tree with a specific field in a linked entity
- Update DataSet-Adapter Linqy way from a list
- LINQ Group By multiple columns and also count
- Get only one value from the table using LINQ
- YALINQO: Query deep array
- Write CLR objects to XML with LINQ
- Intersecting two lists using LINQ
- How to get distinct values separately in string array?
- how do access previous item in list using linQ?
- Dynamically create properties in anonymous type
- Can't get the language entity with the method _languageRepository.FirstOrDefault(x=>x.Name=langCode)
- server side pagination in mvc 4
- LINQ is able to filter on association, but returns 0 results when referenced directly
- LINQ with groupby and count
- How to create a Dictionary from an Array
- how to add function inside select query
- How do i format a date in Linq To Entities
- How do I optimize this Linq query to find blog posts with the most views in past 24 hours