I have a Queue that contains a collection of objects, one of these objects is a class called GlobalMarker that has a member called GlobalIndex.
What I want to be able to do is find the index of the queue where the GlobalIndex contains a given value (this will always be unique).
Simply using the Contains method shown below returns a bool. How can I obtain the queue index of this match?
RealTimeBuffer
.OfType<GlobalMarker>()
.Select(o => o.GlobalIndex)
.Contains(INT_VALUE);
If you need the index then perhaps you are using the wrong collection type. A queue is not designed to support random access (like an array or a
List<T>). If you need random access then perhaps you should be using a type that implementsIList<T>.