Tuesday, August 9, 2011

What is Difference Between Out and Ref keyword in C#?


Out & Ref keywords in C# are used for returning multiple values from a function.


Difference:


Out parameter need to be initialized inside the body of a method but not in the case of ref parameter.


Example of Out Keyword



Example of Ref Keyword


Example of Out & Ref Keyword


No comments: