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
- LinqToSql with dates problem
- What conflicts might I encounter using MongoDB.Driver.Linq and System.Linq in the same namespace?
- Linq calculate average,total and compare the result in query
- MongoDB : Update only those objects in a collection whose 'Id' exists in a list
- LINQ Where(), what to do if I need to get everything?
- Is it possible to format Linq to a price
- Location of XElement when querying over IEnumerable using LINQ
- How to search a text using entity framework after split?
- ContainsValue VB
- Populate subelements of a set of lists
- LINQ - ConflictChangeException
- Linq to SQL "IN" Clause not working
- linqtosql will not allow updating of fields as it casts them as read only
- Get values from stored procedure to class in c# using linqToSql
- Full outer join of two string arrays
- linq to sql c#: replace a foreign key with its string value and keep the table structure
- how to cast object of type '<TakeIterator>[System.Data.DataView]' to type 'System.Data.DataView'.?
- Returning Element value deep inside XDocument
- return type for displaying the duplicates
- Should all linq which gets a database object be surrounded with a try catch?
- Entity Framework error about member no supported
- C# Generic List.Any() throws System.NullReferenceException
- DefaultIfEmpty is ignored
- LINQ to SQL execute method on select
- VS2010 linq Goes To shortcut
- Get Distinct IQueryable with NHibernate
- How to convert Dictionary<string, string> to attribute string in LINQ?
- Many to many on List
- Convert List<IDictionary<string, string>> to strongly typed list in C#
- Union Multiple Classes, Sort on Common Interface