c# pass value by reference
using System;
namespace ProgramName
{
class Program
{
static void Main(string[] args)
{
int x = 10;
Console.WriteLine("Variable Value Before Calling the Method: {0}", x);//10
Square(ref x);
Console.WriteLine("Variable Value After Calling the Method: {0}", x);//100
}
public static void Square(ref int a)
{
a *= a;
Console.WriteLine("Variable Value Inside the Method: {0}", a);//100
}
}
}