title: How to get network adapter index?
body: <p>From code I want to force a Windows machine to use a specific network adapter for all connections to a specific IP address. </p>
  
  <p>I plan to do so by using the ROUTE ADD command line tool, but this requires that I know in advance the network adapters' <em>index number</em> (as it must be given to the ROUTE ADD command).</p>
  
  <p><strong>QUESTION: How can I programmatically retrieve a network adapter's index, given I know its name?</strong></p>
  
  <p>I'm aware that ROUTE PRINT shows me the information I need (the index numbers of all network adapters present), but there must be a way to get that information programmatically too (C#)? </p>
  
  <p>Note, that I don't like parsing the text output from ROUTE PRINT, as the text format may change with different Windows versions.</p>