[OnH1Work error index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space at the end of an array of the index and the target, in the System. The Collections. The Concurrent. The ConcurrentDictionary ` 2. System. Collections. The Generic. ICollection
In the System. Collections. Generic. List ` 1.. Ctor (IEnumerable collection ` 1)
In the System. The Linq. Enumerable. ToList [TSource] (IEnumerable ` 1 source)
In the Device. MainControl. GetTestItem ()
In the Device. MainControl. OnH1Work ()]
Source:
Define ConcurrentDictionary
Private SendItemModel GetTestItem ()
{
SendItemModel itemModel=null;
List
String curKey=string. The Empty;
TempSortList. Sort (enclosing sortList);
The foreach (KeyValuePair
{
CurKey=item. The Key;
This. ScanBarAfterItemList. TryGetValue (curKey, out itemModel);
If (itemModel!=null & amp; & ItemModel. ItemStatus==EnumItemTestStatus. ITSSendToThread)
{
Return itemModel.
}
}
return null;
}
This is where the fault, look not to come out, please help me
CodePudding user response:
Feeling is the enclosing scanBarAfterItemList. TryGetValue (curKey, out itemModel);You put the SendItemModel itemModel=null; To SendItemModel itemModel=new SendItemModel (); Give it a try