get first and last from list c# code example
Example 1: 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);
Example 2: 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