What is ref key word in C#?
658
11-Jun-2024
Ravi Vishwakarma
11-Jun-2024The
refkeyword is used to pass arguments to methods by reference, rather than by value. This means that any changes made to the parameter within the method will affect the original variable outside of the method.Here's how it works:
Output:
Without the
refkeyword, changes made to the parameterxinside theChangeNumberthe method would not affect the originalnumvariable.Read more -
Difference between static, readonly, and constant in C#
What is the use of "p" tag in HTML
How do you change the fonts of the webpage?