title: C# Object property modified in the called function affect caller value
body: <p>I defined a simple class with the following definition.
  In this sample, I defined a simple class with a single string parameter. Then I instantiated this class and assigned a value to the parameter. I passed that instance to another function without specifying "ref" keyword. It means it should be passed by value instead of reference. But what I don't understand is the reason that the output displays "Second Modification" value as a result instead of "First Modification".</p>
  
  <h2>UPDATE 1:</h2>
  
  <p>I think my question was confusing. I know how "ref" and "pass by reference" working. I need to know why when I "pass by value", run-time still changes the value of the original instance. By the way, I couldn't find my answer in the proposed links.</p>
  
  <h2>UPDATE 2:</h2>
  
  <p>I asked this question two years ago. Now I understand all properties of an object (instance of a class) are reference type. It means when I pass an instance of a class to another method, they all behave as a reference to original member of the class.</p>
  
  <hr>
  
  <pre><code>public class MyClass
  {
      public String TestProperty { get; set; }
  }
  
  public class TestClass
  {
      public TestClass()
      {
          var myClass = new MyClass();
          myClass.TestProperty = "First Modification";
          MyFunction(myClass);
          Console.WriteLine(myClass.TestProperty); // Output: "Second Modification"
      }
      void MyFunction(MyClass myClass)
      {
          myClass.TestProperty = "Second Modification";
      }
  }
  </code></pre>