Pass by Reference

In this lesson, we'll discuss how to use pass by reference to pass parameters to methods in C#.


From the documentation :

Passing by reference enables function

  • members
  • methods
  • properties
  • indexers
  • operators
  • constructors

to change the value of the parameters and have that change persist in the calling environment. To pass a parameter by reference, use the ref keyword.


Here’s the syntax used to pass a value by reference:

Get hands-on with 1200+ tech skills courses.