title: Can parameters be constant?
body: <p><strong>I'm looking for the C# equivalent of Java's <code>final</code>. Does it exist?</strong></p>
  
  <p>Does C# have anything like the following:</p>
  
  <pre><code>public Foo(final int bar);
  </code></pre>
  
  <p>In the above example, <code>bar</code> is a read only variable and cannot be changed by <code>Foo()</code>. Is there any way to do this in C#?</p>
  
  <p>For instance, maybe I have a long method that will be working with <code>x</code>, <code>y</code>, and <code>z</code> coordinates of some object (ints). I want to be absolutely certain that the function doesn't alter these values in any way, thereby corrupting the data. Thus, I would like to declare them readonly.</p>
  
  <pre><code>public Foo(int x, int y, int z) {
       // do stuff
       x++; // oops. This corrupts the data. Can this be caught at compile time?
       // do more stuff, assuming x is still the original value.
  }
  </code></pre>