Here is the scenario:
I am a user on the Editor View. The ActiveDocument consists of 2 or more files that I have opened so that I see all of the segment pairs from each file. How can I quickly say I want to get the third ISegmentPair from the second file? The reason I am asking is the code I am working with needs to reference the previous segment of the ActiveDocument.ActiveSegmentPair at some point.
One approach a previous developer took was to Build a Dictionary<int, ISegmentPair> by mapping the ISegmentPair.Properties.Id.Id value to the ISegmentPair object. He then was grabbing the segment pair by id and working with the resulting ISegmentPair object. The problem with this approach, though, is that if I have 2 or more files open, the first file will have ISegmentPair whose Properties.Id.Id is 1 to n, and the second file will have ISegmentPair objects with Properties.Id.Id from 1 to m. So it appears the ISegmentPair.Properties.Id.Id is not actually a way to uniquely identify a segment pair in the ActiveDocument.
The second approach I took was to construct a LinkedList<ISegmentPair> object from the ActiveDocument.SegmentPairs. I then grabbed the active segment pair from the ActiveDocument. The problem is, it appears they haven't overwritten the Equals method so the following code returns null.
LinkedList<ISegmentPair> allSegmentPairs = new LinkedList<ISegmentPair>(ActiveDocument.SegmentPairs);
LinkedListNode<ISegmentPair> current = allSegmentPairsLinkedList.Find(ActiveDocument.ActiveSegmentPair) returns null.
So I can't reference the Previous segment pair by saying current.Previous.
So again, my question is, how do you uniquely identify an ISegmentPair in the ActiveDocument?
Any thoughts would be appreciated.