MapEnumerator.ToString Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a string that represents the current object.
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
Returns
A string that represents the current object.
Remarks
The default implementation returns the class name of the object. The method can be overridden in a derived class to return values that are meaningful for that type. For example, an instance of the SysMethodInfo class returns the method name and type of the method, such as instance or static.
The following example creates a map, and then prints the content of the first and second elements in the map.
{
Map myMap = new Map(Types::Integer, Types::String);
MapEnumerator enumerator;
int i;
// Add some elements to the map
myMap.insert(1, "Element one");
myMap.insert(2, "Element two");
myMap.insert(3, "Element three");
myMap.insert(4, "Element Four");
// Set the enumerator
enumerator = myMap.getEnumerator();
// Go to beginning of enumerator
enumerator.reset();
// Go to the first element in the map
enumerator.moveNext();
// Print first item in the map
print enumerator.toString();
// go to second element
enumerator.moveNext();
// Print second element in map
print enumerator.toString();
pause;
}