.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;
					
public class Program
{
	public static void Main()
	{
		// list of length 2
		var list = new List<string>() { "a", "b" };
		
		Console.WriteLine(list.IndexOf("a", 2)); // yields -1
		Console.WriteLine(list.IndexOf("a", 3)); // yields an error
	}
}
;