How to split string words into ArrayList in C#

1 Answer

0 votes
using System;
using System.Linq;
using System.Collections;

public class Program
{
    public static void Main()
    {
        string s = "c# software programming";

        string[] arr = s.Split(' ').ToArray();

        ArrayList al = new ArrayList(arr);

        foreach (object item in al) {
            Console.WriteLine(item);
        }
    }
}





/*
run:

c#
software
programming

*/ 

 



answered Nov 12, 2021 by avibootz
...