Understanding ref and out keywords - Language C#

This is a very initial video tutorial showing about ref and out keywords. 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. The out keyword also causes argument to be passed by reference. There is no need to initialize the out variable, as it requires in case of ref variable.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.
9y
6.1k
500