📅  最后修改于: 2022-03-11 14:48:52.204000             🧑  作者: Mango
List strings = new List(){"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