public static int getDestinationPort(String sourceNodeName, int sourceNodePort) { int destinationNodePort = 0; for (int i = 0; i < connectionsBetweenNodes.Count; i++) { LinksRow checkedRow = connectionsBetweenNodes.ElementAt(i); String nodeName = checkedRow.getSourceNodeName(); int port = checkedRow.getSourceNodePort(); if (sourceNodeName.Equals(nodeName) && port == sourceNodePort) { destinationNodePort = checkedRow.getDestinationNodePort(); } } return(destinationNodePort); }