Re: Reusing Delegate objects

Tech-Archive recommends: Fix windows errors by optimizing your registry



What I am
trying to accomplish is that when any of the 64 datapoint instances fires
it's changed event, my client instance receives notification of this.

That will work using the single delegate.

If efficiency is really an issue, you might want to work around having arrays of objects fire events. You could define the change function in the DataPoints object, like:

	class DataPoints
	{
		public ChangeDataPoint( int iDatapointNumber, int iNewValue );
	}

When the ChangeDataPoint function is called, the DataPoints class knows a change is about to happen. In that way you are avoiding the overhead of 64+ events.

Greetings,
Wessel
.