Destinations

My Diagram is created in a way that there is never more then one link from a port. and therefore never more than one Destination. yet I can’t use the code:

node.Destinations[0] or node.BottomPort.Links[0]
How do people usually handle this type of thing. Right now I have the code I want wrapped in a foreach which I know will only ever have one iteration.
Dave

I create the following function:

static public T getElementAloneInEnumerable(IEnumerable enumerable) where T : class
{
IEnumerator enumerator = enumerable.GetEnumerator();
enumerator.Reset();
enumerator.MoveNext();
T result = enumerator.Current as T;
Debug.Assert(!enumerator.MoveNext());
Debug.Assert(result != null);
return result;
}

Basically, this is the same as the for-each, only a little bit cleaner I think. It could be easier to use (as many other parts of the product) if GoDiagram used generic collections.