I have the following error message:
\'System.Collections.Generic.Dictionary\' does not
contain a definition for \'biff\' and no extensi
You need to access the Value of the Dictionary for a given key. Something along these lines.
foreach(var item in dbContext.DBView)
{
foreach(var key in cart.Keys)
{
cart[key].biff = item.biff;
}
}
The problem is this part: cart.biff
. cart
is of type Dictionary<int, SpoofClass>
, not of type SpoofClass
.
I can only guess what you are trying to do, but the following code compiles:
Dictionary<int, SpoofClass> cart = new Dictionary<int, SpoofClass>();
int i=0;
foreach (var item in dbContext.DBView)
{
cart.Add(i, new SpoofClass { biff = item.biff });
++i;
}