How to create a comma delimited string from an ArrayList in C#

1 Answer

0 votes
using System;
using System.Collections;

public class Program
{
    public static void Main(string[] args)
    {
        ArrayList al = new ArrayList(); 
        
        al.Add("c"); 
        al.Add("c++"); 
        al.Add("java"); 
        al.Add("python"); 
        al.Add("c#"); 

        string str = string.Join(", ", al.ToArray());
        
        Console.WriteLine(str);
        
    }
}

 
/*
run:
   
c, c++, java, python, c#
   
*/

 



answered Jun 3, 2024 by avibootz

Related questions

1 answer 136 views
1 answer 132 views
2 answers 249 views
1 answer 194 views
194 views asked Apr 30, 2017 by avibootz
1 answer 193 views
2 answers 233 views
...