C#中的Java Map等效项
我正在尝试使用选择的键来保存集合中的项目列表。在Java中,我将仅使用Map,如下所示: class Test { Map<Integer,String> entities; public String getEntity(Integer code) { return this.entities.get(code); } } 在C#中有等效的方法吗? System.Collections.Generic.Hashset不使用哈希并且我不能定义自定义类型键 System.Collections.Hashtable不是泛型类 System.Collections.Generic.Dictionary没有get(Key)方法