Skip to content

Commit f905be4

Browse files
committed
C#: Add a RedundantToStringCall test case.
1 parent 261b8db commit f905be4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

csharp/ql/test/query-tests/Useless Code/RedundantToStringCall/RedundantToStringCall.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ public void M(object o)
99

1010
Console.WriteLine($"Hello: {o.ToString()}"); // BAD
1111
Console.WriteLine($"Hello: {o}"); // GOOD
12+
13+
Console.WriteLine("Hello: " + o.ToString()); // BAD
14+
Console.WriteLine("Hello: " + o); // GOOD
1215
}
1316
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
| RedundantToStringCall.cs:7:27:7:38 | call to method ToString | Redundant call to 'ToString' on a String object. |
22
| RedundantToStringCall.cs:10:37:10:48 | call to method ToString | Redundant call to 'ToString' on a String object. |
3+
| RedundantToStringCall.cs:13:39:13:50 | call to method ToString | Redundant call to 'ToString' on a String object. |
34
| RedundantToStringCallBad.cs:7:45:7:56 | call to method ToString | Redundant call to 'ToString' on a String object. |

0 commit comments

Comments
 (0)