Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
XML
<?xml version="1.0" encoding="utf-8"?>
<math>
  <number>2</number>
  <number>3</number>
  <number>4</number>
  <number>5</number>
</math>




i have written foreach loop to get values and display it as report in html format.
now i just wan to count number iterations of foreach loop. i spent more time in google but i could't find result.


Thanks in advance.
Posted

1 solution

You have to do it manually - there is no "loop count" you can get access to (or probably even that exists - see IInumerable for details)
int count = 0;
foreach (Item i in Collection)
   {
   count++;
   ...
   }
 
Share this answer
 
Comments
Balaji_Reddy 14-Jun-11 8:14am    
i am asking solution for xslt . not in java or in .net.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900