the first problem is, that it's not able to save a ref to a variable afaik! and the next problem is, that the ref is only as long valid, as it is in the scope of the function ->
Code:
void dummy(ref int x)
{
only here x is valid !, as soon as the program jumps back to where dummy was called
from, x is invalid !
this works fine as long as we don't want to pass a permanent reference to a variable!
to make it permanent it would be necessary to stay as long in this scope, as we need the ref !
I tried that with Threads, but as mentioned - too much overhead and calling the function is
at least as ugly as the lambda approach ...
}
and one may also not use lambdas which use variables that are declared 'ref'!