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:
I create the following function:
static public T getElementAloneInEnumerable(IEnumerable enumerable) where T : class
IEnumerator enumerator = enumerable.GetEnumerator();
T result = enumerator.Current as T;
Debug.Assert(result != null);
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.