If I have a function that takes a ref argument like:
void Foo(ref int i, int b, int c){
i = b + c;
}
and I want to call that function with the ref int i argument determined conditionally:
int q, r;
bool bTest;
//...
if (bTest)
{
bar(ref q,1,2);
}
else
{
bar(ref r,1,2);
}
is it possible to locally declare something like a pointer or reference type to q/r and then pass that to bar?
Coming from c++:
int q, r;
bool bTest;
//...
int *pI;
if (bTest)
{
pI = &q;
}
else
{
pI = &r;
}
bar(*pI,1,2);