Hi
I use a event in a extensive calculation method to inform a client.
therefor i implement a eventhandler and eventargs (e.g. myEvent,
myEventArgs) and a OnMyEvent(myEventArgs e) method to fire the event.
e.g.
// extensive calculation in 2 dim.
for (int x = 0; x < xMax; x++)
{
for (int y = 0; y < yMax; y++)
{
float flow = calculateflow(....)
// here i will inform the client -- create always a new
myEventArgs
myEventArgs e = new myEventArgs( x,y, xMax, yMax, flow);
OnMyEvent(e);
....
alternatively i can do:
myEventArgs e = new myEventArgs(x,y);
for (int x = 0; x < xMax; x++)
{
for (int y = 0; y < yMax; y++)
{
float flow = calculateflow(....)
// here i will inform the client - using one and the same
"e"
e.X = x;
e.Y = y;
e.Flow = flow;
OnMyEvent(e);
....
"What is the better way"
particularly with regard to performance and resources ?
Is there a "DotNet recommendation" ?
thanks
Peter