Class: Dictionary

Namespace: System.Collections.Generic

Library: mscorlib.dll

An object of Dictionary is like an ArrayList that can be indexed by a key and not by position.

The Class has a confuse constructor. You need to define the types of the key/value:

Dictionary dc = new Dictionary<string, string>(); 

The methods:

Add(something)

This method adds a new element and returns the new quantity of elements of the Dictionary;

Example:

Clear()

Contains(key, something)

Remove(key)

The properties:

Count

Values

We can create an ArrayList using this property:

Example:

An item of a Dictionary can be an ArrayList. This can be useful sometimes.


PREVIOUS LESSON NEXT LESSON
T.CONTENTS HOMEPAGE