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);

You can use pointer types in C# however they are rarely needed. Check out msdn's article on pointer types in C#.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.