2016-05-21 50 views
-1

enter image description here當我運行此代碼並且所有響應均可以,但如果在我的課程中添加了更多響應,則會顯示錯誤,並且我被卡住。請幫助我。我會感謝你。超出範圍指數超出範圍。必須是非負的,並且小於集合的大小。參數名稱:i

else if(auths.Count != payable.Length) 
     { 
      for (int i = 0; i < payable.Length; i++) 

      { 

       var item = new PayableTransfers 
       { 
        URN = payable[i].uniqueReferenceNumber, 
        OperationDate = payable[i].operationDate, 
        TransactionCode = payable[i].transactionCode, 
        IsBlocked = payable[i].isBlocked, 
        PaymentMode = payable[i].paymentMode, 
        DestinationCode = payable[i].destinationCode, 
        DestinationAddress = payable[i].destinationAddress, 
        IsIncident = payable[i].isIncident, 
        IsRequestedForCancelation = payable[i].isRequestedForCancelation 


       }; 
       var set = payable[i].uniqueReferenceNumber; 
       var setss = sets[i]; 
       if (setss == set) 
       { 
        repositorylist.Update(item); 
       } 
       else 
       { 
        repositorylist.Add(item); 
       } 

      } 
     } 
+0

其中線,很可能您的收藏沒有指定索引? – Sajeetharan

+0

var setss = sets [i]; 第9個數字從底部 –

+0

是它有9個元素從數據庫中提取和設置(響應)有13個元素 –

回答

0

的訪問不舉行任何價值將索引設置,您需要檢查值

var setss = sets[i]; 
if(i < payable.length -1) 
{ 
if (setss.contains(set[i]) 
{ 
    repositorylist.Update(item); 
} 
} 
相關問題