c# – Writing custom indexer for generic dictionary with enumeration as its key – Education Career Blog

I have a generic dictionary, with an enumeration as its key and an int as its value.

I can’t use an indexer on this (error is cannot apply indexer).

How could I write a custom indexer to enable this functionality?

Thanks

,

Could you do this?

Dictionary<YourEnum, int> dic = new Dictionary<YourEnum, int>();

dic.ElementAt(index);

But If I am not understanding the question can you specify a little more…

Leave a Comment