I have the following method in my code
public override string ToString()
{
return string.Format(
CultureInfo.InvariantCulture, "{{0}} Text = \"{1}\"", Matrix, Text);
}
Matrix
is a struct and Text
is a string.
However, Code Analysis gives me following warning for the method:
CA2241
Provide correct arguments to formatting methods
Method 'XX.ToString()' calls
'string.Format(IFormatProvider, string, params object[])'
and does not provide a format item for argument "1".
The provided format string is: '"{{0}} Text = \"{1}\""'
For me it seems like the code of ToString()
is valid. What I am missing?