Using Action <PointerClass *> as an Argument
I am creating a performance-critical application that implements image manipulation. I use some pixel pointers using my structure with a name Pixelto do some processing. I have many pieces of code that iterate over all the bitmap image data, and to reuse the code and modularity, I am developing a method that will act and apply it to all pixels of the image (for example, to the map function). However, when I write Action<Pixel*>, Visual Studio complains about code saying that the type Pixel*cannot be used as an argument to the type. The whole class is in context unsafe, and I use pointers Pixeleverywhere, but I just can't use a pixel pointer as an action pattern class.
I can use it Action<IntPtr>, but I will need to convert it to the corresponding pointers inside the method body in EVERY iteration, which will kill the whole idea of "critical performance".