Alex Rivera | Logout

Example of practical of "ref" use

Asked 2011-01-10T11:07:33.700
11

I am struggling how to use "ref" (to pass argument by reference) in real app. I would like to have simple and mainly meaningful example. Everything I found so far could be easily redone with adding return type to the method. Any idea someone? Thanks!

Edit
Report

1 Answer

0

I think a good example would be trampolining.

This is where you take a recursive function and rework it to a method that is repeatidly called on a set of values. The reason being that instead of going into the stack very deeply the stack remains flat because you return after every call instead of calling yourself.

Regards GJ

answered 2011-01-10T11:23:10.753

Your Answer