public static ValidatedHandle GetNthConnection(this Topology.Database.InputTopologyEnumerable e, InputPortID port, int index) { InputPortArrayID id = new InputPortArrayID(port); var currIndex = 0; foreach (var filtered in e[id]) { if (currIndex == index) { return(filtered); } currIndex++; } throw new IndexOutOfRangeException("Index of connection or port does not exist"); }
/// <summary> /// Send a message of a specific type to a message input port on a node. /// </summary> /// <param name="handle">The node to be messaged.</param> /// <param name="port">A <see cref="MessageInput{TDefinition,TMsg}"/> port on the given node.</param> /// <param name="msg">The content of the message to be delivered.</param> /// <typeparam name="TMsg">The type of message data. Must correspond to the type of the given <see cref="MessageInput{TDefinition,TMsg}"/>.</typeparam> /// <exception cref="InvalidOperationException">Thrown if the request is invalid.</exception> public void SendMessage <TMsg>(NodeHandle handle, InputPortID port, in TMsg msg)