Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you mean <a href="http://msdn.microsoft.com/en-us/library/14akc2c7.aspx" rel="nofollow"><code>ref</code> the argument passing convention</a>, then no, you cannot store this. From the first note on MSDN:</p> <blockquote> <p>Do not confuse the concept of passing by reference with the concept of reference types. The two concepts are not the same...</p> </blockquote> <hr> <p><strong>Edit</strong>: based on your updated question, C# has different nomenclature about pointers and references. <a href="http://msdn.microsoft.com/en-us/library/y31yhkeb.aspx" rel="nofollow">A <strong>pointer</strong> in C# is an <em>unsafe</em> construct</a> used to <em>somewhat</em> directly reference the memory location of an object. I say somewhat because the memory location can change based on garbage collection (unless you fix it in memory).</p> <p><a href="http://msdn.microsoft.com/en-us/library/s6938f28.aspx" rel="nofollow"><strong>References</strong> in C# are the default way reference types are passed and stored</a>. They are akin to <em>pointers</em> in other languages, but not quite the same. However, the <strong>by-reference</strong> argument passing convention allows you to directly change what an object refers to.</p> <p>If your objective is to keep a <em>mutable reference</em> to a non-reference type local variable, you'll have to encapsulate the local variable in a <a href="http://msdn.microsoft.com/en-us/library/ms173109.aspx" rel="nofollow">reference type (like a class)</a>. If you could give some sample code, we can give some specific examples.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload