May 2004
Intermediate to advanced
888 pages
22h 31m
English
As with the Collection, it is likely that you might need a strongly-typed Dictionary. In the HashTable example presented in this chapter, the data stored could have been any type descending from System.Object. The following section illustrates how to create a Dictionary that enforces the TStateInfo type.
The System.Collections namespace defines the DictionaryBase class. From this class, you should derive your strongly-typed dictionary classes. Listing 10.7 shows such a class.
1: unit d4dnDevGuide.StateDictionary; 2: interface 3: 4: uses 5: System.Collections; 6: 7: type 8: 9: // Define a class to store in the dictionary 10: TStateInfo = ... |
Read now
Unlock full access