title: Need help understanding a code
body: <p>so this program I'm on has sprites. Each sprite has a limit to the number of frames its sprite can have, and I'm trying to figure out how to learn that limit so I can modify it. But the code that I've been reading is really difficult for me. I've been reading up on some of the stuff it uses (like <code>Dictionary</code> and <code>Out</code>), but when I try to apply that reading to the code, it just falls apart.</p>
  
  <p>So uh, if someone would be willing to kind of dissect the code and tell me what it says, that would be great. The full of it can be found <a href="https://github.com/Frosty2011/PJOGameFiles/blob/2c0c32ec86c926ad924e0ca0dbd6fdb2bf2a8088/ServerFilesFixed/Server/Graphics/SpriteSheet.cs" rel="nofollow">here</a>, but this is what I'm trying to read in particular:</p>
  
  <pre><code>class FrameData {
      Dictionary&lt;FrameType, Dictionary&lt;Enums.Direction, int&gt;&gt; frameCount;
  }
  
  public FrameData() {
      frameCount = new Dictionary&lt;FrameType, Dictionary&lt;Enums.Direction, int&gt;&gt;();
  }
  
  public void SetFrameCount(FrameType type, Enums.Direction dir, int count) {
      if (frameCount.ContainsKey(type) == false) {
          frameCount.Add(type, new Dictionary&lt;Enums.Direction, int&gt;());
      }
      if (frameCount[type].ContainsKey(dir) == false) {
          frameCount[type].Add(dir, count);
      } else {
          frameCount[type][dir] = count;
      }
  }
  
  public int GetFrameCount(FrameType type, Enums.Direction dir) {
      Dictionary&lt;Enums.Direction, int&gt; dirs = null;
      if (frameCount.TryGetValue(type, out dirs)) {
          int value = 0;
          if (dirs.TryGetValue(dir, out value)) {
              return value;
          } else {
              return 0;
          }
      } else {
          return 0;
      }
  }
  </code></pre>