title: assignment doesn't modify the variable in List ForEach function with lambda expression
body: <p>I'm writing a simple encrypting for my homework. I have completed it, now i'm trying to improve my code with lambda expressions. Object in list doesn't change after lambda expression. Is it using a local variable ? And how can i do that with lambda expression. I wrote my code following</p>
  
  <pre><code>public override string Encrypt(string code)
      {
          List&lt;Byte&gt; encodedBytes = new List&lt;Byte&gt;(ASCIIEncoding.ASCII.GetBytes(code));
  
          encodedBytes.ForEach(o =&gt; { if (hash.Contains(o)) 
              o = hash.ElementAt((hash.IndexOf(o) + ShiftAmount) % hash.Count); });            
  
          return ASCIIEncoding.ASCII.GetString(encodedBytes.ToArray());                
      }
  </code></pre>
  
  <p>I'm waiting for your answer, thanks...</p>