我有以下错误信息:
'System.Collections.Generic.Dictionary<int,SpoofClass>' does not
contain a definition for 'biff' and no extension method 'biff'
accepting a first argument of type
'System.Collections.Generic.Dictionary<int,SpoofClass>' could be found
(are you missing a using directive or an assembly reference?)
我在Stack Overflow上查找了相关问题,发现这个问题似乎和我遇到的问题相似(如果不是完全一样)。然而,我尝试了被接受的答案提供的解决方案,但仍然没有任何进展。它表现得好像我缺少一个使用语句,但我几乎可以确定我已经拥有所有需要的使用语句。
以下是产生错误的部分代码:
using locationOfSpoofClass;
...
Dictionary<int, SpoofClass> cart = new Dictionary<int, SpoofClass>();
foreach (var item in dbContext.DBView)
{
cart.biff = item.biff;
...
}
伪造类文件:
namespace locationOfSpoofClass
{
public class SpoofClass
{
public int biff { get; set; }
...
}
}
如果我对变量等进行了重命名,导致您感到困惑,请见谅。如果无法理解或者太难跟踪,或者其他信息与解决方案有关,请让我知道。谢谢!