Consider this code:
var url = "www.example.com";
String.Format:
var targetUrl = string.Format("URL: {0}", url);
String Interpolation:
var targetUrl=$"URL: {url}";
Which of one from string interpolation and string.Format
is better in performance?
Also what are the best fit scenarios for use of them?
According to C# docs string interpolation so maybe there is no difference at all?
... it's typically transformed into a String.Format method call
string.Format
and string interpolation (which is true). This looks like premature optimization issue. – Pheidippides