Note that there are some explanatory texts on larger screens.

plurals
  1. POSome More Program Logic Assistance Requested
    primarykey
    data
    text
    <p>I have these partial listings of two classes. A CiscoSwitch object maintains a list of SwitchConnection objects to other switches. I am trying to write the code that will walk a list of switches and return the switches that have common connections, either to each other or to the same RemoteSwitchName listed in the connection list of the other switches but it might not be in the list of CiscoSwitches I am working with. </p> <p>for example if I have a list of 3 CiscoSwitch instances named A, B and C. A and B might be connected to each other. B and C might not be connected directly to each other but both are connected to D. A might also be connected to D. I am comparing the RemoteSwitchName attribute of each switch connection to the switchName property of the other switches in the list and to the RemoteSwitchName property of the other SwitchConnections on the other switches. </p> <p>I'd prefer to use LINQ rather than a lot of foreach loops if possible.</p> <pre><code>public CiscoSwitch { private string _SwitchName = String.Empty public string switchName{ get{return _SwitchName;} set{_SwitchName=value;} } ... public List&lt;SwitchConnection&gt; SwitchConnectionList = new List&lt;SwitchConnection&gt;(); ... } public class SwitchConnection // a switch connection is a connection to another switch // a switch connection can have multiple portchannels // a switch connection can exist across multiple VSANs { // the name of this switch // not needed, deprecated // private string _LocalSwitchName; // public string LocalSwitchName { get { return _LocalSwitchName; } set { _LocalSwitchName = value; } } // the name of the switch at the other end of the link private string _RemoteSwitchName; public string RemoteSwitchName { get { return _RemoteSwitchName; } set { _RemoteSwitchName = value; } } private string _RemoteIPAddress; public string RemoteIPAddress { get { return _RemoteIPAddress; } set { _RemoteIPAddress = value; } } public Dictionary&lt;int, PortChannel&gt; LocalPortChannelList = new Dictionary&lt;int,PortChannel&gt;(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload