How to pass by reference in C#

1. Calling statement should be like:

callingFunc(ref x, ref y)

2. Definition statement should be like:

public void callingFunc(ref int x, ref string y)

 

NOTE: Classes and objects are passed by reference by default in C#.

Leave a comment