Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic; //add this so as to be able to use List
- namespace LearnLists
- {
- class Program
- {
- static void Main()
- {
- List<double> marathons = new List<double>
- {
- 144.07,
- 143.12,
- 146.73,
- 146.33
- };
- List <double> topMarathons = marathons.GetRange(0,3); //first int is the index of the first desired element and the second int is the number of elements in the desired range.
- foreach(double timing in topMarathons){ //indicate data type for the element variable
- Console.WriteLine(timing);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement