An item with the same key has already been added - dictionary call value c# : <p>i've this error when i call the value from dictionary, but i don't see the error.
my target is get index with value from dictionary.</p>

<p>any solution ?</p>

<p>my error: </p>

<blockquote>
  <p>An item with the same key has already been added.</p>
</blockquote>

<p>my dictionaryclass</p>

<pre><code>public static class DictionaryParamiters
{
    public static Dictionary&lt;int, String&gt; languagesDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "ITA" },
        { 1, "ENG" },
        { 2, "FRA" },
        { 3, "SPA" },
        { 4, "DEU" }
    };

    public static Dictionary&lt;int, String&gt; modelDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "IMX BT" },
        { 1, "IMX B" },
        { 2, "MMX BT" },
        { 3, "MMX B" },
        { 4, "IMX BT (no logo)" },
        { 5, "IMX B (no logo)" }
    };

    public static Dictionary&lt;int, String&gt; batteryDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "GEL" },
        { 1, "WET" },
        { 2, "XFC" },
        { 3, "GEL1" },
        { 4, "WET1" }
    };

    public static Dictionary&lt;int, String&gt; batteryMMGDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "PB" },
        { 1, "GEL" },
        { 2, "XFC" },
        { 3, "PB1" },
        { 4, "GEL1" },
        { 5, "CUSTOM" }
    };

    public static Dictionary&lt;int, String&gt; partialHurmeterdisplayDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "KEY" },
        { 1, "TR" },
        { 2, "BR" },
        { 3, "VAC" }
    };

    public static Dictionary&lt;int, String&gt; resetPartialHourmeterDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "NO" },
        { 1, "KEY" },
        { 2, "TR" },
        { 3, "BR" },
        { 3, "VAC" },
        { 3, "ALL" }
    };

    public static Dictionary&lt;int, String&gt; resetMainHourmeterDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "NO" },
        { 1, "KEY" },
        { 2, "TR" },
        { 3, "BR" },
        { 3, "VAC" },
        { 3, "ALL" }
    };

    public static Dictionary&lt;int, String&gt; serviceWarningCountDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "KEY" },
        { 1, "TR" },
        { 2, "WORK" }
    };        

    public static Dictionary&lt;int, String&gt; noyesDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "NO" },
        { 1, "YES" }
    };

    public static Dictionary&lt;int, String&gt; displayCntDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "KEY" },
        { 1, "TRACTION" }
    };

    public static Dictionary&lt;int, String&gt; zerooneDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "0" },
        { 1, "1" }
    };

    public static Dictionary&lt;int, String&gt; baseversionDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "RULLO" },
        { 1, "DISCO" },
        { 2, "ORBITALE" }
    };

    public static Dictionary&lt;int, String&gt; modelMMGOPLUSDictionary = new Dictionary&lt;int, String&gt;
    {
        { 0, "MMG" },
        { 1, "PLUS" }
    };
}
</code></pre>

<p>when i call</p>

<pre><code>if (tmp.PMC_UM == "")
            {
                string valore = String.Empty;
                //devo prendere la x ed estrarla dal dizionario per stampare le stringhe
                #region VERIFICO LE STRINGHE E LE PRELEVO DAI DICTIONARY
                if (tmp.PMC_Descrizione == "Language")
                {
                    valore = DictionaryParamiters.languagesDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Model" &amp;&amp; DataFile.instance.PMC_SUB_Tipo_Click == null)
                {
                    valore = DictionaryParamiters.modelDictionary[(int)x];
                }

                //if (tmp.PMC_Descrizione == "Model" &amp;&amp; DataFile.instance.PMC_SUB_Tipo_Click != null)
                //{
                //    valore = DictionaryParamiters.modelMMGOPLUSDictionary[(int)x];
                //}

                if (tmp.PMC_Descrizione == "Rst Cnthr"/* || tmp.PMC_Descrizione == "Rst Main Cnthr" || tmp.PMC_Descrizione == "Side brush" || tmp.PMC_Descrizione == "Daylight Enable" || tmp.PMC_Descrizione == "Daylight Enable" || tmp.PMC_Descrizione == "Worklight Enable  " || tmp.PMC_Descrizione == "Dosing system" || tmp.PMC_Descrizione == "Recycle" || tmp.PMC_Descrizione == "Anticollision" || tmp.PMC_Descrizione == "Rear camera" || tmp.PMC_Descrizione == "Manual Op. Enable" || tmp.PMC_Descrizione == "Zone Op. Enable" || tmp.PMC_Descrizione == "Password Enable: User" || tmp.PMC_Descrizione == "Password Enable: PIN"*/)
                {
                    valore = DictionaryParamiters.noyesDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Battery")
                {
                    valore = DictionaryParamiters.batteryDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Battery Type")
                {
                    valore = DictionaryParamiters.batteryMMGDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Display Cnt")
                {
                    valore = DictionaryParamiters.displayCntDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Base version")
                {
                    valore = DictionaryParamiters.baseversionDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Partial Hurmeter display")
                {
                    valore = DictionaryParamiters.partialHurmeterdisplayDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Reset Partial Hourmeter")
                {
                    valore = DictionaryParamiters.resetPartialHourmeterDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Reset Main Hourmeter")
                {
                    valore = DictionaryParamiters.resetMainHourmeterDictionary[(int)x];
                }

                if (tmp.PMC_Descrizione == "Service Warning Count")
                {
                    valore = DictionaryParamiters.serviceWarningCountDictionary[(int)x];
                }
                #endregion

                par.ValoreSettatoOra = valore;
            }
</code></pre>

<p>i'dont find duplicate value... :(</p>
