title: C# : How to add data data from a ListView control to a Dictionary
body: <p>The list view is like</p>
  
  <p><img src="https://i.stack.imgur.com/Ls0jf.jpg" alt="alt text"></p>
  
  <p>i need to add the data from the <code>Listview</code> to a <code>Dictionary&lt;String,String&gt;</code>.</p>
  
  <p>Now i'm using <code>for loop</code> to do this. Is there any way to do this using <code>LINQ</code>.</p>
  
  <p>Finally the Dictionary will contain</p>
  
  <pre><code>{"A","1"}
  {"B","2"}
  {"C","3"}
  </code></pre>
  
  <p><strong>EDIT</strong> My code :</p>
  
  <pre><code>        Dictionary&lt;String, String&gt; Dic = new Dictionary&lt;string, string&gt;();
          for (int i = 0; i &lt; listView1.Items.Count; i++)
          {
              Dic.Add(listView1.Items[i].Text.ToString(), listView1.Items[i].SubItems[1].Text.ToString());
          }
  </code></pre>
  
  <p>Thanks in advance</p>