SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start


From course:

Advanced Concept C# Interview Questions

» Start this Course
(Practice similar questions for free)
Question:

What is the difference between Call By Value and Call By Reference in C#?

Author: Lock Huynh



Answer:

In C#, the difference between Call By Value and Call By Reference lies in how arguments are passed to methods: Call By Value: A copy of the variable's value is passed to the method. Changes made to the parameter inside the method do not affect the original variable outside the method. Call By Reference: The reference (address) of the variable is passed to the method using the ref or out keywords. This allows the method to modify the original variable directly, as it operates on the reference rather than a copy.


0 / 5  (0 ratings)

1 answer(s) in total