Thursday, January 20, 2011

Difference between ref and out parameters

Recently, I have come across a query in a forum. The query was something like 'difference between ref and out parameters'. Hence, I have just tried to point out the difference between the two.


We can pass ref and out parameters through the methods as arguments.

Out Parameter

In case of out parameter , the caller method need not assign a value to the out parameter. Instead the callee method is responsible to assign value in the out parameter.
Let me show u examples:
Sending single unassigned variable using out parameter. 

No comments:

Post a Comment