Original Post
🔒 Locked
c# question - Generic Dictionary
Advertisement
Quote:
Original post by Telastyn
By adding a generic parameter to the owning class (or the method itself I suppose).
Right, but I already have a generic parameter (T) for the value of the dictionary, how do I add one to the key?
Quote:
It might help if we knew what you're trying to do.
I'm implementing the repository pattern. My repository interface looks like this now:
public interface IRepository<T> { T GetById(int id); Dictionary<string, T> GetAll(); void Add(T entity); void Update(T entity); void Remove(T entity); }And now I want to have to implementations of this interface, one for a User where I want the GetAll() method to return a Dictionary
Thanks again
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement