title: Modify Struct variable in a Dictionary
body: <p>I have a struct like this:</p>
  
  <pre><code>public struct MapTile
  {
      public int bgAnimation;
      public int bgFrame;
  }
  </code></pre>
  
  <p>But when I loop over it with foreach to change animation frame I can't do it...</p>
  
  <p>Here's the code:</p>
  
  <pre><code>foreach (KeyValuePair&lt;string, MapTile&gt; tile in tilesData)
  {
          if (tilesData[tile.Key].bgFrame &gt;= tilesData[tile.Key].bgAnimation)
          {
              tilesData[tile.Key].bgFrame = 0;
          }
          else
          {
              tilesData[tile.Key].bgFrame++;
          }
  }
  </code></pre>
  
  <p>It gives me compile arror:</p>
  
  <pre><code>Error 1 Cannot modify the return value of 'System.Collections.Generic.Dictionary&lt;string,Warudo.MapTile&gt;.this[string]' because it is not a variable
  Error 2 Cannot modify the return value of 'System.Collections.Generic.Dictionary&lt;string,Warudo.MapTile&gt;.this[string]' because it is not a variable
  </code></pre>
  
  <p>Why can't I change a value inside a struct which is inside a dictionary?</p>