ABSTRACT

ToString() is called on an array.

EXPLANATION

In most cases, a call to ToString() on an array indicates a developer is interested in returning the contents of the array as a String. However, a direct call to ToString() on an array will return a string value containing the array's type.

Example 1: The following code will output System.String[].


String[] stringArray = { "element 1", "element 2", "element 3", "element 4" };
System.Diagnostics.Debug.WriteLine(stringArray.ToString());

REFERENCES

[1] Class Arrays Microsoft

[2] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 398