In C# we can pass a variable to a function by address, which means, instead of passing value of a variable, we can pass its address. To do so, we can use out, and ref keywords.
The different between ref and out is that, the variable passed with ref keyword must be initialized before passing its reference, where variable initialization is not mandatory in case of out keyword. The following is an example:
static void Main(string args)
int num1 = 10;
static void GetRefValue(ref int num1)
num1 = 100;
static void GetOutValue(out int num2)
num2 = 100;