I've a question.
I most recently changed one of my IDictionary
to a IEnumerable<KeyValuePair>
.
This was made because this collection of items shouldn't be modified.
As i can see these are the same but IEnumerable dosn't implement the Add, remove etc, this made this perfect for me and my area of using this collection.
public IDictionary<string, UserInformation> MyItems;
public IEnumerable<KeyValuePair<string, UserInformation>> MyItems;
Now to my questions.
- Is this the smartest way to go if i don't want the collection to be modified?
- Is there a smarter way in doing this?
- Am i being stupid doing like this?
I found simular posts to this before but none actually explaining what to use and why.