in reply to strange "for " statement
I believe you CAN do references in c#, so that is probably the way to go.
Since this is a perl forum, we will leave you the exercise of figuring out the c# code.