How do I create a comma delimited string from an ArrayList?

前端 未结 6 2288
野的像风
野的像风 2020-12-12 23:15

I\'m storing an ArrayList of Ids in a processing script that I want to spit out as a comma delimited list for output to the debug log. Is there a way I can get this easily w

6条回答
  •  情话喂你
    2020-12-13 00:08

    Here's a simple example demonstrating the creation of a comma delimited string using String.Join() from a list of Strings:

    List histList = new List();
    histList.Add(dt.ToString("MM/dd/yyyy::HH:mm:ss.ffff"));
    histList.Add(Index.ToString());
    /*arValue is array of Singles */
    foreach (Single s in arValue)
    {
         histList.Add(s.ToString());
    }
    String HistLine = String.Join(",", histList.ToArray());
    

提交回复
热议问题