using C5; class Program { static void Main(string[] args) { QuickListnumbers = new QuickList (); numbers.Add(1); numbers.Add(2); numbers.Add(3); Console.WriteLine("Before Clear: " + numbers.Count); // 3 numbers.Clear(); Console.WriteLine("After Clear: " + numbers.Count); // 0 } }
using C5; class Program { static void Main(string[] args) { QuickListIn this example, we create a QuickList of strings and add three words to it. We then print the count of elements in the list before clearing it. We use the Clear method to remove all elements from the list and print the count again to confirm that the method worked as expected. Package/Library: C5.words = new QuickList (); words.Add("apple"); words.Add("banana"); words.Add("cherry"); Console.WriteLine("Before Clear: " + words.Count); // 3 words.Clear(); Console.WriteLine("After Clear: " + words.Count); // 0 } }