Ok,
consider this method
public int sum(int x, int y)
{
int z = x + y;
return z;
}
are the x or y changed during the method process, the response is no for sure, we call those paramters input parameters
Now,
what if you want that x recives the sum of x+y so the x will be at the
same time an input and also an output so it has to be marked as ref
public int sum(ref int x, int y)
{
int x = x + y;
return x;
}
Now, what if the x value is known as input so we dont need to set it, then it will be considered only as an output value
public int sum(out int x, int y)
{
x = 20;
x = x + y;
return x;
}
Loading

