You can find these differences, while using these Ref and Out Parameters:
Both the parameters passed by reference, While for the Ref Parameter you need to initialize it before passing to the function and out parameter you do not need to initialize before passing to function.
you need to assign values into these parameter before returning to the function.
Ref (initialize the variable)
int getal = 0;
Fun_RefTest(ref getal);
Out (no need to initialize the variable)
int getal;
Fun_OutTest(out getal);
0 comments:
Post a Comment