Referring to an item in an IEnumerable with no ID
<p>So I may have coded myself into a corner, and I want to know the best way out.</p>

<p>I have this document editor I'm writing, and one property of the documents being edited is a list of structures. The document is stored as XML, so each of these structures is an XML node and its properties. My <code>Document</code> class exposes these structures as an IEnumerable.</p>

<p>In my editor, I want to literally highlight these structures when the mouse is nearby. I've already done the task of identifying one close to the cursor. But now I have to be able to refer to that instance of the structure, and store that somewhere. Finding the closest one just iterates through the IEnumerable, and returns the structure itself. I suppose that I could use the structure itself as the reference, but then I'm going to wind up saying in my display code <code>if (thing == nearestThing)</code> and it's going to do a hash code comparison or something, right?</p>

<p>That feels like the wrong way to do it, but I don't have a proper ID for these structures either. Suggestions?</p>
