Ref – Out of C#
In this short video tutorial Gaurav Kumar Arora is going to demonstrate Ref – Out of C# with an example
The ref keyword causes argument passed by reference.
The effect is that any changes is made to the parameter in the method will be reflected in that variable when control passes back to the calling method.
To use a ref parameter, both the method definition and the calling method must explicitly use the ref keyword.
An argument passed to to a ref parameter must first be initialized. This differs it from out whose argument need not be explicitly initialize before being passed.
Both ref and out are treated differently at runtime, but treated the same at compilation. Therefore, methods can't be overloaded, if one method takes a ref keyword and the other takes an out argument.
Here is short video tutorial describing Ref-Out:
Hey Chitranjan,
Go through the full Video Tutorial and think what is all about.
You can refer msdn for more info: https://msdn.microsoft.com/en-IN/library/14akc2c7.aspx
https://msdn.microsoft.com/en-IN/library/t3c3bfhx.aspx
If you want to discuss further, reach to me directly.