【发布时间】:2011-08-24 15:31:33
【问题描述】:
我收到以下错误消息:
'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?)
我对此进行了检查,发现this 问题似乎与我有类似(如果不相同)的问题。但是,我尝试了接受的答案中提供的解决方案,但仍然没有提出任何建议。这就像我缺少一个 using 语句,但我几乎可以肯定我拥有我需要的所有 using。
以下是一些产生错误的代码:
using locationOfSpoofClass;
...
Dictionary<int, SpoofClass> cart = new Dictionary<int, SpoofClass>();
foreach (var item in dbContext.DBView)
{
cart.biff = item.biff;
...
}
SpoofClass 文件:
namespace locationOfSpoofClass
{
public class SpoofClass
{
public int biff { get; set; }
...
}
}
对不起,如果我对变量的重命名和诸如此类的东西令人困惑。如果它不可读,或者太难理解,或者如果其他信息与解决方案相关,请告诉我。谢谢!
【问题讨论】:
标签: c# .net wpf compiler-errors