【发布时间】:2022-11-07 08:59:42
【问题描述】:
在这里我有列表和字典
public static List<Category> categories = new List<Category>();
public static Dictionary<string, ProductInfo> ProductInformation = new Dictionary<string, ProductInfo>();
问题:我想显示制作的类别及其数量 使用此代码的产品:
static void ShowCategory() { foreach (var c in Category.categories) Console.WriteLine(ProductDictionary[c.Name].Count); Console.ReadKey(true); ConsoleKey key = ConsoleKey.Escape; }我收到一条错误消息:
CS1503:无法从“方法组”转换为“布尔”
这意味着什么?
【问题讨论】:
标签: c# list dictionary foreach console