title: C# DropDownList with a Dictionary as DataSource
body: <p>I want to set <code>DataTextField</code> and <code>DataValueField</code> of a <code>Dropdownlist</code> (languageList) using a Dictionary (list) of <code>languageCod</code> (en-gb) as key and language name (english) as the text to display.</p>
  
  <p>Relevant Code:</p>
  
  <pre><code>string[] languageCodsList= service.LanguagesAvailable();
  Dictionary&lt;string, string&gt; list = 
                     new Dictionary&lt;string, string&gt;(languageCodsList.Length);
  
  foreach (string cod in languageCodsList)
  {
      CultureInfo cul = new CultureInfo(cod);
      list.Add(cod, cul.DisplayName);
  }
  languageList.DataSource = list;
  languageList.DataBind();
  </code></pre>
  
  <p>How can I set <code>DataTextField</code> and <code>DataValueField</code>?</p>