I'm trying to hold a list of items in a collection with a key of my choice. In Java, I would simply use Map as follows:
class Test {
Map<Integer,String> entities;
public String getEntity(Integer code) {
return this.entities.get(code);
}
}
Is there an equivalent way of doing this in C#?
System.Collections.Generic.Hashset doesn't uses hash and I cannot define a custom type key
System.Collections.Hashtable isn't a generic class
System.Collections.Generic.Dictionary doesn't have a get(Key) method