Get the index of an element inside queue c#
Maybe a List
or an Array
would be better for such actions but you could try this:
queue.ToArray().ToList().IndexOf(email);
You can use extension method, something like:
public static int IndexOf<T>(this IEnumerable<T> collection, T searchItem)
{
int index = 0;
foreach (var item in collection)
{
if (EqualityComparer<T>.Default.Equals(item, searchItem))
{
return index;
}
index++;
}
return -1;
}