title: c# Is it possible get a reference of an object, get the object itself and change it, instead of assinging to a new object?
body: <p>I'm just curious if something like that is possible in c#. I don't know why would anybody want to do it, but it's still interesting if that can be done.:</p>
  
  <pre><code>public class Test
  {
      public string TestString { private set; get; }
      public Test(string val) { TestString = val; }
  }
  
      public class IsItPossible
      {
          public void IsItPossible()
          {
              Test a = new Test("original");
              var b = a;
              //instead of assigning be to new object, I want to get where b is pointing and change the original object
              b = new Test("Changed"); // this will assign "b" to a new object", "a" will stay the same. We want to change "a" through "b"
              //now they will point to different things
              b.Equals(a); // will be false
              //what I'm curious about is getting where b is pointing and changing the object itself, not making just b to point to a new object
              //obviously, don't touch a, that's the whole point of this challenge
  
              b = a;
              //some magic function
              ReplaceOriginalObject(b, new Test("Changed"));
              if (a.TestString == "Changed" &amp;&amp; a.Equals(b)) Console.WriteLine("Success");
          }
      }
  </code></pre>