[Serializable] |
The foreach statement of the C# language (for each) 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) {...}
| ctor #1 | Initializes an instance of the DictionaryEntry class with the specified key and value. |
| Key | Read-write Gets or sets the key in the key-and-value pair. |
| Value | Read-write Gets or sets the value in the key-and-value pair. |
| Equals (inherited from System.ValueType) |
See base class member description: System.ValueType.Equals Indicates whether this instance and a specified object are equal. |
| GetHashCode (inherited from System.ValueType) |
See base class member description: System.ValueType.GetHashCode Returns the hash code for this instance. |
| GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
| ToString (inherited from System.ValueType) |
See base class member description: System.ValueType.ToString Returns the fully qualified type name of this instance. |
| Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
| MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
key
value
| Exception Type | Condition |
|---|---|
| ArgumentNullException | key is null. |
public object Key {get; set;}
|
public object Value {get; set;}
|
obj
~DictionaryEntry(); |
public override int GetHashCode(); |
For more information, see Object.GetHashCode, and Hashtable.
public Type GetType(); |
protected object MemberwiseClone(); |
public override string ToString(); |