次の方法で共有


List.ToString Method

Definition

Returns a description of the values in the list.

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 values of the elements in the list.

Remarks

To print a description of the type of the elements in the list, use the List.definitionString method.

The following example creates a list of integers. The toString method is used to print a description of the values in the list.

{ 
    // Create a list of integers 
    List il = new List(Types::Integer); 
    // Add some elements to the list 
    il.addEnd(1); 
    il.addEnd(2); 
    il.addStart(3); 
    // Print a description of the list 
    print il.definitionString(); 
    print il.toString(); 
    pause; 
}

Applies to