title: C# return struct reference from method
body: <p>In C++, returning a reference of an object allocated on the stack in a method, yields garbage values due to the fact, that the stack object is destroyed as soon the method leaves the scope. Given that in C# structs are allocated on the stack, would this yield garbage values as well?</p>
  
  <pre><code>struct Test
  {
      //data
  }
  
  Test Foo()
  {
      Test t1 = new Test();
      return t1;
  }
  </code></pre>