This documentation is archived and is not being maintained.

DictionaryEntry Structure

Defines a dictionary key-and-value pair that can be set or retrieved.

For a list of all members of this type, see DictionaryEntry Members.


[Visual Basic]
Public Structure DictionaryEntry
public struct DictionaryEntry
public __value struct DictionaryEntry

[JScript] In JScript, you can use the structures in the .NET Framework, but you cannot define your own.

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.


The IDictionaryEnumerator.Entry method returns an instance of this type.

[Visual Basic, C#] The foreach statement of the C# language (for each in Visual Basic) requires the type of each element in the collection. Since each element of the 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 myDE in myHashtable) {...}
[Visual Basic] 
Dim myDE As DictionaryEntry
For Each myDE In myHashtable
Next myDE

[Visual Basic, C#] The foreach statement is a wrapper around the enumerator, which only allows reading from, not writing to, the collection.


Namespace: System.Collections

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: Mscorlib (in Mscorlib.dll)

See Also

DictionaryEntry Members | System.Collections Namespace | IDictionary | IDictionaryEnumerator