How to clear list in c#


  • How to clear list in c#
  • How to empty a C# list?


    To unfurnished a C# list, use the Clear() method.

    Firstly, set a list and supplement elements −

    List<string> myList = new List<string>() {    "one",    "two",    "three",    "four",    "five",    "six" };

    Now, let us empty authority list −

    myList.Clear();

    Example

     Live Demo

    using System; using System.Collections.Generic; public class Program {    public static void Main() {       List<string> myList = new List<string>() {          "one",          "two",          "three",          "four",          "five",          "six"       };       foreach(string str in myList) {          Console.WriteLine(str);       }   &n how to clear list in c

    how to delete list in c

    how to clear checkbox list in c

    how to clear ienumerable list in c

    how to clear dropdown list in c

    how to return empty list in c

    how to create empty list in c

    how to pass empty list in c

    how to check empty list in c

    how to remove list object in c

    how to remove duplicates in list c

    how to remove item from list in c
    using linq
    how to remove duplicates from list in c
    using linq