asp.net.ph

IDictionary Interface

System.Collections Namespace


Represents a collection of key-and-value pairs.

IDictionary Interface Members

Collapse   Properties

Visibility Name Value Type Accessibility
public IsFixedSize Boolean [ Get ]
public IsReadOnly Boolean [ Get ]
public Item ( Object key ) Object [ Get , Set ]
public Keys ICollection [ Get ]
public Values ICollection [ Get ]

Collapse   Methods

Visibility Name Parameters Return Type
public Add ( Object key , Object value ) Void
public Clear ( ) Void
public Contains ( Object key ) Boolean
public GetEnumerator ( ) IDictionaryEnumerator
public Remove ( Object key ) Void

Remarks

The IDictionary class is the base interface for collections of key-and-value pairs.

Each element is a key-and-value pair stored in a DictionaryEntry object.

The IDictionary interface allows the contained keys and values to be enumerated, but it does not imply any particular sort order.

IDictionary implementations fall into three categories: read-only, fixed-size, variable-size.

The foreach statement of the C# language (for each ...next in Visual Basic) requires the type of each element in the collection. Since each element of a collection based on IDictionary is a key-and-value pair, the element type is not the type of the key or the type of the value. Instead, the element type is DictionaryEntry. For example:

foreach ( DictionaryEntry myEntry in myHashtable ) {
   ...
}
  C# VB

Hashtable Class Skip Navigation Links


Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note