We can check on the status of our list in two ways.

We can find the number of elements in the list using the Count property:

List<string> citiesList = new List<string> { "Delhi", "Los Angeles" }; int numberCities = citiesList.Count; // numberCities is 2

We can check if an element exists in a list using the Contains() method:

bool hasDelhi = citiesList.Contains("Delhi"); bool hasDubai = citiesList.Contains("Dubai"); // hasDelhi is true, hasDubai is false



The list marathons has been initialized for you. Print the Count to the console.


In the 2000 Sydney Olympic Games, Naoko Takahashi won the marathon with a time of 143.23 minutes (the Olympic record until 2012 in London).

Use Add() to add that value to the list.


Make sure that 143.23 was added to the list. Call the Contains() method and print the returned value to the console.


Print Count again. Make sure it increased to 5!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?