Using String+string+string vs using string.replace
- by Madi D.
A colleague told me that using the following method:
string url = "SomeURL";
string ext = "SomeExt";
string sub = "SomeSub";
string subSub = "moreSub";
string Url = @"http://www." + Url +@"/"+ ext +@"/"+ sub + subSub;
is not efficenet (takes more resources) and it is preferred to use the following method:
string Url = @"http://www.#URL.#EXT/#sub/#subSub";
string url = "SomeURL";
string ext = "SomeExt";
string sub = "SomeSub";
string subSub = "moreSub";
Url.Replace("#URL",url)
Url.Replace("#EXT",ext);
Url.Replace("#sub",sub);
Url.Replace("#subSub",subSub);
Is that true? and what is the explanation behind it?