How to remove a string from StringCollection at specific index in C#

1 Answer

0 votes
using System;
using System.Collections.Specialized; 
					
public class Program
{
	public static void Main()
	{
		StringCollection sc = new StringCollection(); 
  
        sc.Add("c#"); 
        sc.Add("c++"); 
        sc.Add("java"); 
        sc.Add("php"); 
        sc.Add("python"); 
        sc.Add("javascript"); 

		sc.RemoveAt(3); 
		
		foreach (string s in sc) {
            Console.WriteLine(s);
        }
        
	}
}



/*
run:

c#
c++
java
python
javascript

*/

 



answered May 9, 2020 by avibootz

Related questions

...