using System.Collections;
using System.Collections.Generic;
public static void Main()
var item = new Item { Id = 1 };
IList list = new List<Item> { item };
IList array = new[] { item };
var newItem = new Item { Id = 1 };
var lIndex = list.IndexOf(newItem);
var aIndex = array.IndexOf(newItem);
Console.WriteLine(lIndex);
Console.WriteLine(aIndex);
public class Item : IEquatable<Item>
public int Id { get; set; }
public bool Equals(Item other) => other != null && other.Id == Id;