How to make array elements into a string in which each array element separated by comma(,) without using array properties or any predefined functions

Deepraj
Posted by Deepraj under C# category on | Points: 40 | Views : 1163
 string[] names = new string[5] { "Matt", "Joanne", "Robert" ,"hello","howareu"};
string str = string.Empty;
int temp=0;
try
{
while (names[temp+1] != null)
{

str += names[temp] + ",";
temp++;
}
}
catch(Exception ee)
{
str += names[temp];
}
Response.Write(str);

Comments or Responses

Login to post response