Search This Blog

Thursday, July 15, 2010

what is the equivalent to passing by address in c#

Programmer Question

void Afunction(int* outvar)
{
if(outvar)
*outvar = 1337;
}


note the qualities: it allows you to optionally pass a variable by reference, so that it can be set by the function.



my closest guess would be (ref int? outvar)



but that produces ref (int?) NOT (ref int)? which is what I need



this functionality is hardly a scarcely used feature of c or c++, so I assume there must be some equivalent?



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails