リクエストとレスポンスのデータコントラクトを含むAPIを作成しました。このAPIは、応答をメモ行として取得します。次のようなデータメンバーを含むリクエストデータがあります
- カード番号
- methodID
- noteline1、noteline2、...、noteline18
noteline1、noteline2、...、noteline18として18のデータメンバーを含む応答データコントラクトがあります。コードは次のとおりです。
public CBNotesInqAndMaintResponse CBNote(CBNotesInqAndMaintRequest request)
{
CBNotesInqAndMaintResponse response;
try
{
var processCardBaseEnquiry = new CBNotesInqAndMaint();
request.methodID = "01";
response = processCardBaseEnquiry.Execute(request, clientIpAddress);
processCardBaseEnquiry = null;
return response;
}
catch(Exception ex){}
if (response != null)
{
if (response.noteLine1 != null || response.noteLine1 != "")
{
request.methodID = "02";
request.noteLine1 = response.noteLine1;
processCardBaseEnquiry.Execute(request, clientIpAddress);
}
else if (response.noteLine2 != null || response.noteLine2 != "")
{
request.methodID = "02";
response.noteLine2 = response.noteLine2;
processCardBaseEnquiry.Execute(request, clientIpAddress);
}
// now I want to assign values to the request data from the response
// that I have received with methodID="02" and again execute the
// service to return the desired response.
...
}
コードの行を減らす必要があるので、forループの助けを借りてそれをやりたかったのです。ノートラインテキストの値を割り当ててforループを使用するにはどうすればよいですか