Value types are passed by value : Parameter Value « Language Basics « C# / CSharp Tutorial






using System; 
 
class Test { 
  /* This method causes no change to the arguments used in the call. */ 
  public void noChange(int i, int j) { 
    i = i + j; 
    j = -j; 
  } 
} 
 
class MainClass { 
  public static void Main() { 
    Test ob = new Test(); 
 
    int a = 15, b = 20; 
 
    Console.WriteLine("a and b before call: " + 
                       a + " " + b); 
 
    ob.noChange(a, b);  
 
    Console.WriteLine("a and b after call: " + 
                       a + " " + b); 
  } 
}
a and b before call: 15 20
a and b after call: 15 20








1.14.Parameter Value
1.14.1.Passing ref-types by value
1.14.2.Value types are passed by value