title: Accessing Application variable that hold a dictionary object in C#
body: <p>I have created a Dictionary in Application scope, but I'm not sure how to correctly access it in another page.</p>
  
  <pre><code>  void Application_Start(object sender, EventArgs e) 
  {
  
      Application["PaginationTable"] = new Dictionary&lt;int, int&gt;();
  
      Dictionary&lt;int, int&gt; dictPagination = new Dictionary&lt;int, int&gt;();
  
      //fill dict
      for (int i = 0; i &lt; 40; i++)
      {
          etc
      }
  
      Application["PaginationTable"] = dictPagination;
  
  }
  </code></pre>
  
  <p>In myotherpage.cs</p>
  
  <pre><code> foreach (KeyValuePair&lt;int, int&gt; pair in Application["PaginationTable"])
    {
  
        Response.Write(pair.Key +" :: " + pair.Value  + "&lt;br&gt;");
        etc
    }
  </code></pre>
  
  <p>The error generated is:
  "foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'"</p>
  
  <p>The gist is that I need to create a Dictionary to hold a table of value/pair data that will not change and will need accessing/compared by different sections of the website.</p>
  
  <p>Help appreciated</p>