Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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.

System.Object
   System.ValueType
      System.Collections.DictionaryEntry

[Visual Basic]
<Serializable>
Public Structure DictionaryEntry
[C#]
[Serializable]
public struct DictionaryEntry
[C++]
[Serializable]
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.

Remarks

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:

[C#] 
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.

Requirements

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft