Questions tagged [concurrentdictionary]

ConcurrentDictionary is a .Net thread-safe collection of key-value pairs that can be accessed by multiple threads at the same time.

ConcurrentDictionary is a .Net thread-safe collection of key-value pairs that can be accessed by multiple threads at the same time.

References

331 questions
0
votes
1 answer

How to remove an item from a nested ConcurrentDictionary?

What I'm trying to do is to keep online members of group chats in memory. I've defined a static nested dictionary like this: private static ConcurrentDictionary> onlineGroupsMembers = new…
Blendester
  • 1,583
  • 4
  • 19
  • 43
0
votes
1 answer

Parallel ConcurrentDictionary counters

this program similar to word count. I have a large file each line contains a key and 2 number I need to sum the delta values by each key. All keys are given, the text file won't have any key that is not in the list. Problem is each time I run with…
Benny Ae
  • 1,897
  • 7
  • 25
  • 37
0
votes
0 answers

Why doesn't ConcurrentDictionary explicitly implement the Add method?

Why doesn't ConcurrentDictionary explicitly implement the Add method, since it is supposed to extend IDictionary which defines this method: void Add(TKey key, TValue value); I read that this is owed to "explicit interface…
Sami
  • 113
  • 3
  • 12
0
votes
1 answer

How to span a ConcurrentDictionary across load-balancer servers when using SignalR hub with Redis

I have ASP.NET Core web application setup with SignalR scaled-out with Redis. Using the built-in groups works fine: Clients.Group("Group_Name"); and survives multiple load-balancers. I'm assuming that SignalR persists those groups in Redis…
Nour
  • 5,252
  • 3
  • 41
  • 66
0
votes
0 answers

Should I use SignalR to populate a ConcurrentQueue and process it using Task Parallel Library (TPL)?

I have a P2P client I'm building and want the inbound message flow to use SignalR -> System.Collections.Concurrent -> TPL Dataflow for all inbound messages. I would then send messages using a similar construction, either notifying existing SignalR…
0
votes
2 answers

Implementing ConcurrentDictionary

I'm trying to create my own Cache implementation for an API. It is the first time I work with ConcurrentDictionary and I do not know if I am using it correctly. In a test, something has thrown error and so far I have not been able to reproduce it…
avechuche
  • 1,470
  • 6
  • 28
  • 45
0
votes
0 answers

Concurrency programming for parsing a gigabyte file Into one global dictionary

I’ve a 2Gig text file. In my program, I read line by line using mmap, and form a ordered-dictionary. It takes almost 40 mins to finish the program. I’m thinking about concurrence way here to reduce the timing. Program will divide the file into 50…
0
votes
1 answer

Auction Timer is not working as expected in Asp.net webAPI

public class AuctionTimer : IDisposable { public static readonly ConcurrentDictionary Timers; private readonly Timer timer; static AuctionTimer() { Timers = new ConcurrentDictionary
0
votes
1 answer

Concurent dictionary locking

I am currently reading code delivered by our extern person and I don't understand this part of the code: private ConcurrentDictionary users = new ConcurrentDictionary(); private Dictionary
Jacfal
  • 15
  • 6
0
votes
0 answers

Valid ConcurrentDictionary usage

I got a piece of code where an Entity can make multiple operations, one of those operations for example is rate an Entry. But I want to limit concurrency with lock free code, so the Entity cant send the rate operation to the same entry at the same…
ffenix
  • 543
  • 1
  • 5
  • 22
0
votes
1 answer

Must an IDictionary implementation that implements INotifyPropertyChanged be thread safe?

I'm looking at this code for an observable dictionary I want to use with Xamarin.iOS / Android. There are comments and answers that indicate that the concurrency isn't a concern. Generally speaking, when dealing with an object that implements…
0
votes
2 answers

c# - ConcurrentDictionary.TryGet(): Do I need to use while?

I am not sure I fully understand TryGet method. When does it exactly return false - when the internal lock is locked and it means I should use while if I want to get value (knowing it's there)? Or this while is somehow embedded in this function…
bgee
  • 989
  • 2
  • 13
  • 19
0
votes
0 answers

ConcurrentDictionary.TryGetValue returns false even though the VS debugger shows that the value is there

I have a strange situation. I am using a variant of BiDictionary implementation here.. I also use the Dictionary type to ConcurrentDictionary for firstToSecond The problem is that at the code ConcurrentDictionary firstToSecond; …
Graviton
  • 81,782
  • 146
  • 424
  • 602
0
votes
1 answer

How to share static ConcurrentDictionary between two classes

So i want to share my concurrent dictionary object between two classes, dictionary object is static. top of my head thinking to do something like this. but i believe there should be better way to do this. is there any way around so i don't need to…
Buzz
  • 6,030
  • 4
  • 33
  • 47
0
votes
0 answers

Is putting a concurrentdictionary inside a concurrentdictionary a good data structure?

I'm building a signalR dictionary that used to add symbols data and clients connected to a specific symbol with a specific resolution. My classes structure looks like that public class Symbol { public ConcurrentDictionary
E.Hamed
  • 15
  • 5