How to remove element from ArrayList in C#

1 Answer

0 votes
using System;
using System.Collections;
     
class Program
{
    public static void PrintArrayList(ArrayList list) { 
         foreach (var e in list) {
            Console.WriteLine(e);
        }
    } 
    static void Main() {
        ArrayList al = new ArrayList();
            
        al.Add("java");
        al.Add("c#");
        al.Add("python");
        al.Add("c");
        al.Add("php");

        PrintArrayList(al);
        
        al.Remove("python");
        
        Console.WriteLine("\n\n");
        
        PrintArrayList(al);
    }
}
    
     
     
/*
run:
     
java
c#
python
c
php



java
c#
c
php
     
*/

 



answered Apr 21, 2020 by avibootz

Related questions

1 answer 199 views
1 answer 186 views
1 answer 199 views
199 views asked Jan 7, 2017 by avibootz
1 answer 180 views
1 answer 163 views
1 answer 214 views
1 answer 174 views
...