With the following code I'm trying to pass in 'CachedModel model' which has a list of items List<CachedModel.CachedModelItem>
. However the foreach doesn't like 'Item'. Nor does it like Item.GetType() or Type myType = Item.GetType(); foreach(myType item ...
Error is: "The type or namespace name 'Item' could not be found (are you missing a using directive or an assembly reference?)"
Any ideas?
Call:
FillCache<CachedModel.CachedModelItem>(model, CachedEntitiesID);
Method:
public void FillCache<cachedModelItem>(ICachedModel model, int CachedEntitiesID)
where cachedModelItem: ICachedModelItem, new()
{
ICachedModelItem Item = new cachedModelItem();
foreach (Item item in model.Items)
{
string foo = item.foo.ToString();
}
}