Problem with userdefined Arrays

FreewareFire

Active member
Joined
May 23, 2003
Messages
28
Hi,

i have a big Problem with this code:

C#:
class Tile
		{
			public int x;
			public int y;
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			int Counter1, Counter2, iC;

			iC = 10;			

			for (Counter1 = 0; Counter1 != iC; Counter1++)
			{
				for (Counter2 = 0; Counter2 != iC; Counter2++)
				{

					Tile[,] CTile = new Tile[iC,iC];
				
					CTile[Counter1, Counter2].x = 5;
				}
			
			}
		}

i need a 2 dimensional array, but this code throws out an error. Could someone help me? Or has a better solution? If i define the Array as int its no Problem, but if i do with the Tile class, it wont run. Thx. for help! :)
 
Last edited by a moderator:
Back
Top