Printing a comma (,) after each item in an array

前端 未结 7 764
轮回少年
轮回少年 2020-12-20 17:28

Lets say I have an array (or list) of items

A[] = [a,b,c,d,e]

If I want to print them out so each item is separated by a comma (or any othe

7条回答
  •  隐瞒了意图╮
    2020-12-20 17:44

    string separator = String.Empty;
    for(int i=0; i < A.Length; i++)
    {
        Console.Write(seperator);
        Console.Write(A[i]);
        separator = ",";
    }
    

提交回复
热议问题