Difference between Call by value and Call by Reference

Опубликовано: 15 Октябрь 2024
на канале: Code with Salman
2,264
27

in this video we will learn :
1-what is call by value function in c#
2-what is call by reference in c#
---------------------------------------------------------------------
C# Call By Value:
In C#, value-type parameters are that pass a copy of original value to the function rather than reference. It does not modify the original value. A change made in passed value does not alter the actual value.

C# Call By Reference:
C# provides a ref keyword to pass argument as reference-type. It passes reference of arguments to the function rather than copy of original value. The changes in passed values are permanent and modify the original variable value.
------------------------------------------------------------------------------
code link:
http://learnfromsalman.blogspot.com/2...