If I want to execute that function it doesn't work.
showdict(RedWineMenu._RedWineMenu);
My classes:
public class RedWine : Wine
{
public override string Prepare
{
get
{
return $"Well, {this.Name} wine temperture's same as room temperture. \n All you need to do is pour it into a glass and serve.";
}
}
public override string Name
{
get
{
return $"{base.Name} ({this.Year})";
}
}
}
public class Wine : Drink
{
public int Year { get; set; }
}
public class Drink : Idrink
{
public virtual string Name { get; set; }
public virtual string Prepare { get; }
}
This function in the same class as showdict
:
private void showdict (Dictionary<int, Drink> dict)
{
foreach (var item in dict)
{
Console.WriteLine($"{item.Key} - {item.Value.Name}");
}
}
public class RedWineMenu : Menu
{
public Dictionary<int, RedWine> _RedWineMenu { get; private set; }
public class Menu
{
public string KindOfDrink { get; set; }
}
I do'nt get it. If "Drink" is the futher class of RedWine - why can't insert it into that dictionary? How can I do it?