我的以下方法引发错误:
错误 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;
}
知道为什么它会抛出错误。