Share via


Array.ToString Method

Definition

Returns a string that describes the contents of the array.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Returns

A string that describes the contents of the array.

Remarks

The following example creates an array of integers and adds some values to it. The toString method is used to print the values that the array holds.

{ 
    Array     myArray; 
    Set set1 = new Set(Types::Integer); 
    Set set2 = new Set(Types::Integer); 
    int i; 
    myArray = new Array(Types::Integer); 
    // Add some values to the array. 
    for (i = 1; i< 10; i++) 
    { 
        myArray.value(i, i*2); 
    } 
    // Print out the values in the array. 
    print myArray.toString(); 
    pause; 
}

Applies to