A Function To Concat String Array Values By Specified Delimiter

Let 's Say I have Following Array:

string[] st = new string[5];
st[0] = "Animation";
st[1] = "Action";
st[2] = "Romance";
st[3] = "Drame";
st[4] = "Comedy";

Now I want to Merge all of it with ',' Delimiter Like Below:

Output : Animation,Action,Romance,Drame,Comedy

We will Call it Like This:
string str = GetAllStringsFromArrary( st,",");

Check here for better understanding: [snipped]

Edited 5 Years Ago by Ezzaral: Snipped link.

use string.Join!!
public string GetAllStringsFromArrary(string[] strArray,string strDelimeter)
            string strFinal = string.Empty;
            for (int i = 0; i < strArray.Length ; i++)
                strFinal += strArray[i];
                if (i != strArray.Length - 1)
                    strFinal += strDelimeter;
            return strFinal;

Being a Posting Whiz, Have you never come across string.split and string.join inbuilt methods??..

Edited 5 Years Ago by samueal: n/a

my first comment was a little sarcasm .. yes i know about string.split and string.join very well..

this was snippet was made very long ago.. i just posted it here to share ...

and the title Posting Wiz doesn't mean i know it all.. even the most talented people have flaws.. :)

polite enough.
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.