に各項目を渡すと、私はそう、このは、ループおよび方法
list<string> OldlicenseList = new List<string>{"abcs", "rtets", "taya", "tctct"}; //sample data
list<string> subscriptionList = new List<string> {"udud", "ydyyd" , "tsts","tstst", "hghs"} //Sample data
私はここに私が必要
foreach (var strOldLicense in OldlicenseList)
{
foreach (var subscriptionList in objSubscription.lstClsLicense)
{
newLicenseList.Add(subscriptionList.license_key);
isInserted = _objcertificate.UpdateClpInternalLicense(subscriptionKey, _objUserInfo.GetUserAcctId(), strOldLicense, subscriptionList.license_key, expiryDT);
if (!isInserted)
{
new Log().logInfo(method, "Unable to update the Subscription key." + certID);
lblErrWithRenewSubKey.Text = "Application could not process your request. The error has been logged.";
lblErrWithRenewSubKey.Visible = true;
return;
}
insertCount++;
if (insertCount >= 4)
{
break;
}
}
}
の下に、次のようにやっているように、文字列の2つのリストを持っています両方のリストからそれぞれのアイテムをメソッドUpdateClpInternalLicenseに渡し、2番目のリスト(subscriptionList)に5個のアイテムがありますが、そのメソッドに5番目のアイテムの送信を停止する必要があります。
第一のリスト内の4つの項目があるので、私は、各リストから1つのアイテムを渡す必要..を私は方法を上述試みたが、問題が一旦内側ループが完了している..それは再び介してループ意志
4回の反復まで、その方法、第4回の繰り返しの後、私は両方のループから出てくる必要がある。..事前に
いずれかが非常に感謝されることを、任意のアイデアを提案してくださいだろう。..
を感謝..
Mmm ...別の 'if(insertCount> = 4){ブレーク; } 'あなたの最初のforeachで...? –
'' 'foreach'''の代わりに' '' for'''を使ってみましたか? –
'foreach'の代わりに単純な 'for'ループを使用して、何度も繰り返し実行してみましょう – Nitin