title: Passing object from Main() to function changes the object , even though C# is by value?
body: <p>Consider the following code : </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace Test
  {
      class Person
      {
          public Person(String name)
          {
              this.first = name;
          }
  
  
          private String first;
          public void setName(String name)
          {
              this.first = name;
          }
  
          public String getName()
          {
              return this.first;
          }
      }
      class Program
      {
          public static void changeName(Person per)
          {
              per.setName("Jack");
          }
  
          public static void changeToNull(Person per)
          {
              per = null;          
          }
  
          static void Main(string[] args)
          {
              Person p = new Person("David");
              Console.WriteLine(p.getName());
              changeName(p);
              Console.WriteLine(p.getName());
              changeToNull(p);
              Console.WriteLine(p.getName());
          }
      }
  }
  </code></pre>
  
  <p>The output is : </p>
  
  <pre><code>David
  Jack
  Jack
  </code></pre>
  
  <p>From my understanding C# is by value , so why when passing <code>p</code> to <code>changeName()</code> , it also changes the <code>p</code> in Main() , but when I set it to <code>null</code> , it keeps <code>Jack</code> !?</p>