Calling System.Object's (or System.ValueType's) ToString method on a value returns the fully qualified name of the type of that value. In most cases this is not useful, or what was intended. This rule finds explicit and implicit calls to the default ToString methods.

Override the default ToString method, if possible, or perform bespoke string conversion.

In the following example, the default ToString method is invoked first on an object of type Person, and then on an integer array. The output results are p: Bad+Person and ints: System.Int32[], respectively.

In the fixed example, the ToString method is overridden in the class Person, and string.Join is used to print the elements of the integer array (it is not possible to override ToString in that case). The output results are p: Eric Arthur Blair and ints: 1, 2, 3, respectively.

  • MSDN: Object.ToString Method, ValueType.ToString Method.