How to remove specific string from StringCollection in C#

1 Answer

0 votes
using System;
using System.Collections.Specialized; 

public class Program
{
    public static void Main()
    {
		String[] arr = new String[] { "c#", "c++", "c", "php" }; 

		StringCollection sc = new StringCollection(); 
        sc.AddRange(arr); 
		
		sc.Remove("c++"); 
  
        foreach (string s in sc) {
            Console.WriteLine(s);
        }
    }
}



/*
run:
 
c#
c
php
 
*/
  

 



answered May 8, 2020 by avibootz

Related questions

...