Answers for "c# which index in list"

C#
7

c# list index

// Get the first item from the list

using System.Linq;

var myList = new List<string>{ "Yes", "No", "Maybe"};
var firstItem = myList.ElementAt(0);

// Do something with firstItem
Posted by: Guest on August-13-2020
0

c# list find index

// given list1 {3, 4, 6, 5, 7, 8}
list1.FindIndex(x => x==5);  // should return 3, as list1[3] == 5;
Posted by: Guest on February-25-2022

C# Answers by Framework

Browse Popular Code Answers by Language