c# – Does string interpolation perform better than string.Format?


I use Resharper and a few days ago I started using some C# 6 features.

In various parts of the code I use string.Format() and I've noticed that Resharper suggests that these snippets be replaced with string interpolation .

The question is: why does Resharper suggest this switch?

string.Format() string interpolation perform better than string.Format() or is this suggestion just to make the code more readable?


There is no difference. The compiler will call string.Format() whenever you use the $ notation.

In other words, the generated IL will be the same. Therefore, there is no performance difference.

Source: https://roslyn.codeplex.com/discussions/570614

Scroll to Top