what is different between join() and Concat()

Posted by Gow.Net under C# on 3/7/2012 | Points: 10 | Views : 3921 | Status : [Member] | Replies : 3
what is different between join() and Concat() in string method

gowthaman8870226416


Responses

Posted by: Hmanjarawala on: 3/7/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi

String.Join allows seperator as explicit parameter and string.Concat doesn't have such parameter.

string.Join(seperator, stringarray[]);

string.concat(stringarray[])


With .NET 4.0, String.Join() uses StringBuilder class internally so it is more efficient.
Whereas String.Concat() uses basic concatenation of String using "+" which is of course not an efficient approach as String is immutable.

as compared String.Join() in .NET 2.0 framework where its implementation was different. But with .NET 4.0, String.Join() is using StringBuilder() internally so its like easy wrapper on top of StringBuilder() for string concatenation.


Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 3/7/2012 [Member] Silver | Points: 25

Up
0
Down
Please refer this link
http://www.codeproject.com/Tips/199564/Few-extension-methods-of-String-concatenation-in-C

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 3/7/2012 [Member] Starter | Points: 25

Up
0
Down
Refer this

http://codeissue.com/issue.php?i=i34ddfa424c64b0

Thanks&Regards
LakshmiNarayana Nalluri.

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response