c# - Referring to an item in an IEnumerable with no ID -


so may have coded myself corner, , want know best way out.

i have document editor i'm writing, , 1 property of documents being edited list of structures. document stored xml, each of these structures xml node , properties. document class exposes these structures ienumerable.

in editor, want literally highlight these structures when mouse nearby. i've done task of identifying 1 close cursor. have able refer instance of structure, , store somewhere. finding closest 1 iterates through ienumerable, , returns structure itself. suppose use structure reference, i'm going wind saying in display code if (thing == nearestthing) , it's going hash code comparison or something, right?

that feels wrong way it, don't have proper id these structures either. suggestions?

there no problem way. keep in mind though, should make sure == (and greater extend, equals , gethashcode) reliably produce same results same inputs.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -