// Inspired by https://twitter.com/Nick_Craver/status/702693060472414208
public class Framework_Interpolated_vs_ToString
{
private long counter = 0;
[Setup]
public void Setup()
{
counter = 0;
}
[Benchmark]
public new string ToString()
{
return counter.ToString() + " ms";
}
[Benchmark]
public string InterpolatedString()
{
return $"{counter} ms";
}
}
Last active
December 20, 2016 00:00
-
-
Save mattwarren/d2be775eec5a7adba928 to your computer and use it in GitHub Desktop.
Benchmark of C# 6 String Interpolation vs calling ToString() directly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How does it scale with the number of interpolated parameters?