Answers for "get first and last item list c#"

C#
0

get first and last item list c#

List<string> _ids = new List<string>() { "aaa", "bbb", "ccc", "ddd" };
var first = _ids.First();
var last = _ids.Last();
Console.WriteLine(first);
Console.WriteLine(last);
Posted by: Guest on April-23-2020
0

get first and last item list c#

List<string> _ids = new List<string>() { "aaa", "bbb", "ccc", "ddd" };
var first = _ids[0]; //first element
var last = _ids[_ids.Count - 1]; //last element
Posted by: Guest on April-23-2020

Code answers related to "get first and last item list c#"

C# Answers by Framework

Browse Popular Code Answers by Language