mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
C#: More implicit ToString examples.
This commit is contained in:
@@ -10,6 +10,10 @@ public class TestImplicitToString
|
||||
}
|
||||
}
|
||||
|
||||
public class Container2 : Container { }
|
||||
|
||||
public class Container3 { }
|
||||
|
||||
public class FormattableContainer : IFormattable
|
||||
{
|
||||
public string ToString(string format, IFormatProvider formatProvider)
|
||||
@@ -40,5 +44,11 @@ public class TestImplicitToString
|
||||
y = "Hello" + formattableContainer; // Implicit call to ToString().
|
||||
y = $"Hello {formattableContainer}"; // Implicit call to ToString(string, IFormatProvider). We don't handle this.
|
||||
y = $"Hello {formattableContainer:D}"; // Implicit call to ToString(string, IFormatProvider). We don't handle this.
|
||||
|
||||
var container2 = new Container2();
|
||||
y = "Hello" + container2; // Implicit Container.ToString call.
|
||||
|
||||
var container3 = new Container3();
|
||||
y = "Hello" + container3; // Implicit Object.ToString call.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| implicitToString.cs:31:27:31:35 | call to method ToString |
|
||||
| implicitToString.cs:33:22:33:30 | call to method ToString |
|
||||
| implicitToString.cs:35:22:35:30 | call to method ToString |
|
||||
| implicitToString.cs:40:23:40:42 | call to method ToString |
|
||||
| implicitToString.cs:35:27:35:35 | call to method ToString |
|
||||
| implicitToString.cs:37:22:37:30 | call to method ToString |
|
||||
| implicitToString.cs:39:22:39:30 | call to method ToString |
|
||||
| implicitToString.cs:44:23:44:42 | call to method ToString |
|
||||
|
||||
Reference in New Issue
Block a user