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 = Url.Replace("#URL",url)
Url = Url.Replace("#EXT",ext);
Url = Url.Replace("#sub",sub);
Url = Url.Replace("#subSub",subSub);
Is that true? and what is the explanation behind it?
I read this Answer and it got me wondering what about this case :
string Url = @"http://www.#URL.#EXT/#sub/#subSub";
string url = "SomeURL";
string ext = "SomeExt";
string sub = "SomeSub";
string subSub = "moreSub";
string finalUrl = new StringBuilder(Url )
.Replace("#URL", "URL")
.Replace("#EXT", "EXT")
.Replace("#sub", "sub")
.Replace("#subSub", "subSub")
.ToString();
is that more efficenet then ??