get set on array


hello, using follow:

        private int[] walls = new int[4]{-1,-1,-1,-1};            public int[] walls          {              { return walls; }              set { walls = value; mb.redraw(); }          }

but when this: 

walls[2] = 0;

it use instead set, how can everytime value on array changed launch mb.redraw? have create specific method this?

you use indexer, class containing 'walls' need centered around 'walls' make sense:

	public int this[int index] 	{ 		get 		{ 			return walls[index]; 		} 		set 		{ 			walls[index] = value; 		} 	}


convert between vb, c#, c++, & java (http://www.tangiblesoftwaresolutions.com)
instant c# - vb c# converter
instant vb - c# vb converter




Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user