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

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
}


??
 
N

Nicholas Paldino [.NET/C# MVP]

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[])?
 
J

Jamie Risk

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top