사전 < 문자열, 사전 < 문자열, 개체 >> 및 nVelocity 템플릿을 사용하여 데이터를 표시하려고합니다. 인덱스가있는 사전의 키를 가져 오려고합니다. 나는 초보자이다.NVELocity의 사전 <string, Dictionary <string, object >>
색인이있는 키에 액세스하는 방법을 알려주세요. 예 : 0 인덱스에서 키에 액세스하고 반복을 통해 데이터를 표시하는 방법과 foreach 루프에 "break"문을 삽입하는 방법은 무엇입니까?
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr class="HeaderOne">
<td align="left">Class</td>
#foreach($services in $VolumeSummary)
#foreach($item in $VolumeSummary[$services])
<td class="numeric-th">$item.AverageUnitPriceF</td>
#end
#break
#end
<td class="numeric-th">Average Price</td>
<td class="numeric-th">Total</td>
</tr>
#foreach ($item in $TotalsByServiceAndTermYear)
<tr style="color:#333;font-weight:normal;">
<td>$item.Service</td>
<td class="numeric-td">
$!item.Year
</td>
<td class="numeric-td">
$!item.AverageUnitPriceF
</td>
<td class="numeric-td">
$!item.TotalPriceF
</td>
</tr>
#end
</tbody>
</table>
NVelocity에 대한 단서가 없지만 '사전'은 주문되지 않으므로 첫 번째 키를 얻기 위해 액세스 할 수있는 실제 색인이 없습니다. – HimBromBeere
우리는 모든 키를 얻은 다음 C# –
에서 첫 번째 인덱싱 된 키를 얻을 수 있습니다. 그러나 이것은 결정적이지 않습니다. 특히 더 새로운 .NET 버전에서 변경 될 수 있습니다. – HimBromBeere