View Problem
Fetch an element of a list by index
Given the list
Submit a new solution for cpp or csharp
There are 22 other solutions in additional languages (clojure, erlang, fantom, fsharp ...)
[One, Two, Three, Four, Five], fetch the third element ('Three')
csharp .NET 3.5 + C# 3.0
// Make sure you import the System.Linq namespace.
// This is not the preferred way of indexing if you are using Lists.
string[] items = new string[] { "One", "Two", "Three", "Four", "Five" };
IEnumerable<string> list = new List<string>(items);
string third = list.ElementAt(2); // Three
// This is not the preferred way of indexing if you are using Lists.
string[] items = new string[] { "One", "Two", "Three", "Four", "Five" };
IEnumerable<string> list = new List<string>(items);
string third = list.ElementAt(2); // Three
Submit a new solution for cpp or csharp
There are 22 other solutions in additional languages (clojure, erlang, fantom, fsharp ...)




