The Role of IDictionary
A dictionary is simply a collection that maintains a set of name/value pairs. For example, you could
build a custom type that implements IDictionary such that you can store Car types (the values) that
may be retrieved by ID or pet name (e.g., names). Given this functionality, you can see that the
IDictionary interface defines a Keys and Values property as well as Add(), Remove(), and Contains()
methods. The individual items may be obtained by the type indexer, which is a construct that allows
you to interact with subitems using an arraylike syntax. Here is the formal definition:
public interface IDictionary :
ICollection, IEnumerable
{
bool IsFixedSize { get; }
bool IsReadOnly { get; }
Do'stlaringiz bilan baham: |