我的下面的方法是抛出一个错误:
错误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;
}
任何想法为什么它会抛出错误。