0

Differences between ref and out in method.

Can someone explain the difference between ref and out in a method if possible explain with program

17th Dec 2019, 6:34 AM
saurabh s
saurabh s - avatar
2 Answers
+ 1
From geeksforgeeks.org: The ref is a keyword in C# which is used for the passing the arguments by a reference. Or we can say that if any changes made in this argument in the method will reflect in that variable when the control return to the calling method. The ref parameter does not pass the property. The out is a keyword in C# which is used for the passing the arguments to methods as a reference type. It is generally used when a method returns multiple values. The out parameter does not pass the property. full article: https://www.google.com/amp/s/www.geeksforgeeks.org/difference-between-ref-and-out-keywords-in-c-sharp/amp/
17th Dec 2019, 9:44 AM
Igor Kostrikin
Igor Kostrikin - avatar
+ 1
This may explain about it and hopefully clear your doubt 👍 https://www.c-sharpcorner.com/article/ref-and-out-keywords-in-C-Sharp/
17th Dec 2019, 9:46 AM
Ipang