How to remove element from a list by value in C#

1 Answer

0 votes
using System;
using System.Collections.Generic;

class Program
{
    static void Main() {
        var list = new List<int>() { 2, 4, 9, 7, 3, 6, 0, 8 };
        
        list.Remove(6);

        Console.WriteLine(string.Join(" ", list));
    }
}




/*
run:

2 4 9 7 3 0 8

*/

 



answered Mar 9, 2023 by avibootz

Related questions

1 answer 132 views
1 answer 209 views
2 answers 264 views
1 answer 175 views
1 answer 187 views
1 answer 141 views
1 answer 146 views
146 views asked Feb 10, 2017 by avibootz
...