I have code like this:
for (int i = 1; i < max; i++)
{
<div>@i</div>
<div>@test[i]</div>
}
I’m using MVC3 razor syntax so it might look a bit strange.
My max is always less than ten and I would like to have a value like “A”, “B” .. etc appear between the first instead of the number “1”, “2” .. which is the value of i. Is there an easy way I can convert i to a letter where i = 1 represent “A” and i=2 represents “B”. I need to do this in C# which I can place in my MVC3 view file.
Marife
(char)(i + 64)will work (65 = ‘A’)