0

私の以下のメソッドはエラーをスローしています:

エラー 205 非静的フィールド、メソッド、またはプロパティ 'System.Collections.DictionaryEntry.Key.get にはオブジェクト参照が必要です

 static string GetConfigValue(NameValueCollection tempCollection)
    {

        string paymentDisposition = string.Empty;

        Hashtable tempCollectionHash = new Hashtable();
        foreach (string key in tempCollection.Keys)
        {
            tempCollectionHash.Add(key, tempCollection[key]);
        }


        if(tempCollectionHash.ContainsKey("Cancellation"))
            paymentDisposition = (string)tempCollectionHash["Cancellation"];

        foreach (DictionaryEntry entry in tempCollectionHash)
        {
           if (DictionaryEntry.Key.Contains(" Cancellation"))
           {
               paymentDisposition = DictionaryEntry.Value.;
           }
        }

        return paymentDisposition;

    }

なぜそれがエラーを投げているのか考えてみてください。

4

0 に答える 0