View Problem

Fetch an element of a list by index

Given the list [One, Two, Three, Four, Five], fetch the third element ('Three')
ExpandDiskEdit
cpp C++/CLI .NET 2.0
String^ result = list[2];
DiskEdit
csharp .NET 2.0
string[] items = new string[] { "One", "Two", "Three", "Four", "Five" };
List<string> list = new List<string>(items);
string third = list[2]; // "Three"
DiskEdit
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

Submit a new solution for cpp or csharp
There are 22 other solutions in additional languages (clojure, erlang, fantom, fsharp ...)