Reusable report section

Hi all,

I have a code from a report that could be reused in other reports as well, so I wanted a way where I can write down this code in a class and re-use it wherever I want to.

eg. Consider a method that accepts two int parameters and prints the sum.

void AddThem (int _x, int _y)
//int z; declared in class declaration
z = _x + _y;

Now, this method belongs to report X which has a programmable section that displays “z”, the same code would be used in another report, for that I have to copy the etire code and use it. Is there any way where I can write the functionality in a class and get necessary programmable sections executed?