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?



Could you do this?

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


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

Leave a Comment