Accessing Indexes for .NET Classes

You can access the indexes of .NET classes in the same way you access PowerBuilder array elements. However, in standard PowerBuilder applications, you can reference indexes only using integral datatypes, such as integer, short, long, and so on.

In the .NET environment, you are not restricted to referencing indexes as integral types; you can reference the indexes using any datatypes as parameters.

This example shows how to use a string datatype to access the index of the .NET hashtable class, countries:
#IF Defined PBDOTNET then
system.collections.hashtable countries
countries = create system.collections.hashtable
//Assign value to hashtable
countries["Singapore"] = 6
countries["China"] = 1300
countries["United States"] = 200
//Obtain value from hashtable
int singaporePopulation, USAPopulation
singaporePopulation = countries["Singapore"]
USAPopulation = countries["United States"]
#END IF