Changing an Actual Parameter in C#

Posted by Lu Lu on Stack Overflow See other posts from Stack Overflow or by Lu Lu
Published on 2010-03-31T05:01:15Z Indexed on 2010/03/31 5:13 UTC
Read the original article Hit count: 437

Filed under:
|

In C++, I have a function:

void MyFunction(int p)
{
    p=5;
}

Assume, I have:

int x = 10;
MyFunction(x); // x = 10
MyFunction(&x); // x = 5

How to archieve this in C# with condition: I create only one MyFunction.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET