Ienumberable<T> / Event Handler design question...

  • Thread starter Thread starter Jamie Risk
  • Start date Start date
J

Jamie Risk

As an example supposing I have an object:

public class myClass
{
public List<byte[]> listOfBytes;
public int X;
public int Y;
}

and a method ("op()") whose signature is:

public delegate void ByteOp(byte[] b, int x, int y);


How would I go about creating an Event Handler to execute what
is essentially the inner workings of a foreach similar too:

foreach (byte[] b in listOfBytes)
{
operation(b,x,y); // Do this once per published event
}


??
 
Jamie,

Can you be more specific? From what I understand, you just want a
method that will take your delegate, and then execute it for every iteration
of the loop (which, btw, you have to define b as a byte, not byte[])?
 
Nicholas said:
Jamie,

Can you be more specific?

At the time I couldn't, but now there's no need. As is usual,
this question too came from a lack of understanding about the
language and the underlying CLR.

I figured it out.
 
Back
Top