So, I enjoy the compiler! I will also add it here: "The type (my class) must be non-empty in order to use it as the" T "parameter in the general method"
This does not make sense to me since my method is not general. This is how I call offensive code:
Item? inputtedItem = SearchProduct(txtProduct.Text);
Meanwhile, here is the definition of SearchProduct:
private Item? SearchProduct(string product)
{
if (_inventory == null || _inventory._productList.Count == 0)
{
return null;
}
return _inventory[product];
}
I believe that I will add an indexer from my inventory class here for a good estimate:
public Item this[string i]
{
get
{
Item returnItem;
_productList.TryGetValue(i, out returnItem);
return returnItem;
}
set
{
_productList.Add(i, value);
}
}
Does anyone know what happened?
Thanks for the help.
source
share