stuart-d2
4/22/2015 - 5:30 PM

List: Count, Clear, Access Single Element

List: Count, Clear, Access Single Element

/*
	• To get the number of elements, use count
	• Count on the list type is equivalent to Length on Arrays.
	• Clear will erase all elements 
		○ Also, instead of calling clear, List can be assigned to null with similar results.


*/


//using System;
//using System.Collections.Generic; 

class Program 
{


static void Main()
{
	List<bool> list = new List<bool>();
	list.Add(true);
	list.Add(false);
	list.Add(true);
	Console.WriteLine(list.Count); //3
	//Accessing a single element..
	Console.WriteLine(list[0]);  
	list.Clear();
	Console.WriteLine(list.Count); // 0
	
}

}