This is a migrated thread and some comments may be shown as answers.

Console.WriteLine -> redundancy

1 Answer 20 Views
Code Analysis
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Wolfgang
Top achievements
Rank 1
Wolfgang asked on 24 Jul 2013, 07:59 AM
Hi, 
JustCode does not seem to know the format overload of Console.WriteLine().
Therefore it tries to suggest for working code something which does not work.

In the example below, Telerik shows as fix: "Move to Parameter" or "String.Format". 
If String Format is choosen, the working one is translated 
to a string.Format with null values.

(Is there any possibility to show which rule marks a line as bad line?)

Best regards,
Wolfgang

Original Code:
Console.WriteLine("Value for {0} \t: {1}", somename, somevalue);
Suggested Code by JustCode:
Console.WriteLine(String.Format("Value for {0} \t: {1}",null,null), somename, somevalue);

1 Answer, 1 is accepted

Sort by
0
Zdravko
Telerik team
answered on 26 Jul 2013, 10:25 AM
Hi Wolfgang,

 Thanks for the feedback.
I successfully reproduced the issue and logged it for fixing in our system.
Thanks.

Regards,
Zdravko
Telerik
Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
Tags
Code Analysis
Asked by
Wolfgang
Top achievements
Rank 1
Answers by
Zdravko
Telerik team
Share this question
or