title: IDictionary and Connection.RetrieveStatistics .NET/C#
body: <p>I see code like the following in several books and examples online. The problem is they all feed in a single method into a dictionary object which requires two.</p>
  
  <pre><code>IDictionary statistics = connection.RetrieveStatistics();
  </code></pre>
  
  <p>Which returns the IDE error:</p>
  
  <pre><code>Error   1   Using the generic `type 'System.Collections.Generic.IDictionary&lt;TKey,TValue&gt;' requires '2' type arguments   C:\Users\SGM7\Documents\ASPX 3_5 book code\Pro ASP.NET 3.5\Chapter07\Website\Tester.aspx.cs 22  9   C:\...\Website\`
  </code></pre>
  
  <p>So even though connection.RetrieveStatistics() returns pairs, how can I get IDictionary to accept connection.RetrieveStatistics()?</p>
  
  <p>Here's the code block.</p>
  
  <pre><code>connection.Open();
  connection.StatisticsEnabled = true;
  
  IDictionary statistics = connection.RetrieveStatistics();
  
  lblBytes.Text = "Received bytes: " + statistics["BytesReceived"].toString();
  connection.Close();
  lblBytes.Text += connection.State.ToString();
  </code></pre>