title: Do value-type extension methods provide write-access to the original value?
body: <p>I'm writing extension methods for value-types (such as <code>int</code>) for some custom small-volume encoding and decoding algorithms.<br>
  There may be other designs that don't use extension methods, but I'm concerned this isn't the last time I'll be facing this problem, so I'd like to know how extension methods are expected to work with this type of design.</p>
  
  <p>For example:</p>
  
  <pre><code>int i = 10;
  
  string str = i.Encode(); // Convert 10 to an unpredictable string such as "tZh0Ao"
  
  i = 5; // Overwrite i with a new value.
  
  i.Decode(str); // Decrypt the string to reassign the original value of 10
  </code></pre>
  
  <p>I'm not sure how the <code>this</code> parameter works for value-type extension methods.<br>
  Is it just a copy of the original value?<br>
  Or does it work like a <code>ref</code> or <code>out</code> parameter, preserving changes made to the value of the parameter?</p>
  
  <p>For example:</p>
  
  <pre><code>/* This method will decode a string,
     and assign the decoded value to 'this' int. */
  
  public static void Decode(this int value, string str)
  {
      int result;
  
      /* ... perform work with str to produce decoded value ... */
  
      value = result; // Assign the decoded value to 'this' int.
  
      /* If 'value' is just a copy of the original int,
         the assignment won't have any permanent effect. */
  }
  </code></pre>