0

I have a concurrent dictionary declared as global variable like

 private static readonly ConcurrentDictionary<int, int> PageVersusRowCheckboxStatus = new ConcurrentDictionary<int, int>();

and Here I am adding values into it

 PageVersusRowCheckboxStatus[j] = iPageIndex - 1;

Now, I need to find out the last entered value in the dictionary. How to get it?

Lara
  • 2,821
  • 7
  • 39
  • 72
  • 3
    You'll have to keep track of it separately, probably using an explicit 'last entry' variable. Dictionaries don't have a concept of order so 'last' doesn't really make sense. – Glorin Oakenfoot Jan 12 '17 at 15:37
  • @RandomStranger well the Dictionary rules stil apply – lois6b Jan 12 '17 at 15:40
  • @GlorinOakenfoot Which you'll need to do carefully given that this is being manipulated from multiple threads. – Servy Jan 12 '17 at 15:40
  • @servy you can lock the dictionary, or instead of a variable, a list recording the order of elements – lois6b Jan 12 '17 at 15:42

0 Answers0