Answers for "index for list c#"

C#
4

index of item in list C#

List<string> strings = new List<string>(){"bob","ate","an", "apple"};
strings.IndexOf("bob");
//returns 0 
strings.IndexOf("an");
//returns 2
strings.IndexOf("apple");
//returns 3
strings.IndexOf("banana");
//returns -1
//Because banana is not in the list, IndexOf() returns -1
Posted by: Guest on May-19-2021
0

index list c#

list1[0];
Posted by: Guest on October-04-2021

C# Answers by Framework

Browse Popular Code Answers by Language