csharp Use Mod to find even and odd rows

for (int i = 0; i < 10; i++)
{
	if (i % 2 == 0)
	{
		//even
		sb.Append("Odd number/row");
	}
	else
	{
		//odd
		sb.Append("Even number/row");
	}
}
The above demonstrates using Mod to determine if a row is even or odd. This can be adapted for styling alternate rows differently.

Updated: Friday 27th May 2011, 12:42pm

There are 0 comments

Leave a comment of your own

Comments are currently closed.