Hi Nisha,
I'd strongly suggest that this forum isn't going to have the right expertise to interpret your .NET code. I'd suggest translating it to pseudo code as best you can and posting here as well to help others understand what you are attempting to achieve. It could very well make all the difference with the explanation you've provided.
I hope that helps.