title: Does c# compiler resolve reference of references during compilation?
body: <p>From C programming language as far as I remember if any pointer is assigned to another pointer, we would use ** prefix for accessing to original value. </p>
  
  <p>How does this work when I pass an object instance to a method as  <code>ref Myobject myObject</code> argument. Does c# resolve the  heap address of the object and call <code>printSomething</code> in such code below?</p>
  
  <pre><code>void testFunction(ref MyObject myObject){
      myObject.printSomething();
  }
  </code></pre>
  
  <p>So if this was a recursive function would compiler follow the reference addresses until it finds the object?</p>
  
  <p>I am adding a test scenario below;</p>
  
  <pre><code>public class Test
  {
  
  
      public Test()
      {
          StringBuilder str = new StringBuilder();
          Function(ref str);
          Console.WriteLine(str.ToString());
      }
  
      int referenceCount = 0;
  
      int Function(ref StringBuilder sBuilder)
      {
          referenceCount++;
  
          if (referenceCount == 100)
          {
              sBuilder.Append("foo");
              return referenceCount;
          }
  
          Function(ref sBuilder);
          return referenceCount;
      }
  
      public static void Main(string[] args)
      {
          new Test();
          Console.ReadLine();
      }
  
  }
  </code></pre>
  
  <p>If I remove if block as expected gives stack over flow exception so for each method call a new reference is reserved in stack.After linking 100 of them to each other I am calling a method on the last one.
  Will <code>sBuilder.Append("foo");</code> code follow the linked references until it reaches to the object?</p>