March 2004
Intermediate to advanced
560 pages
26h 47m
English
public struct DictionaryEntry { // Constructors public DictionaryEntry (object key, object value); // Properties public object Key { set; get; } public object Value { set; get; } }
|
AH Note that we've used properties here when fields would have done. Using properties ensures that we can change the implementation later without breaking user code. In the design of the .NET Framework we preferred using properties over instance fields in almost every case. JR When using the C# foreach statement with a Hashtable, each element through the loop is a DictionaryEntry. This is not obvious from the documentation and I know many programmers who have gotten stumped by this. |
Read now
Unlock full access