title: Convert CIDR notation into IP range
body: <p>We are using the GeoLite2 database in order to implement an <strong>IP -> country</strong> lookup. For performance reasons, we want to import the CSV and convert it to our own format.</p>
  
  <p><strong>The CSV is represented like this:</strong></p>
  
  <pre><code>5.39.40.96/27,3017382,3017382,,0,0
  5.39.40.128/28,3017382,3017382,,0,0
  5.39.40.144/28,2635167,3017382,,0,0
  5.39.40.160/27,3017382,3017382,,0,0
  5.39.40.192/26,3017382,3017382,,0,0
  5.39.41.0/25,3017382,3017382,,0,0
  5.39.41.128/26,3017382,3017382,,0,0
  5.39.41.192/26,2635167,3017382,,0,0
  5.39.42.0/24,3017382,3017382,,0,0
  5.39.43.0/25,3017382,3017382,,0,0
  </code></pre>
  
  <p>So we need to convert the CIDR notation (<strong>example: <code>5.39.40.96/27</code></strong>) into an IP address range. <em>(From IP - To IP)</em></p>
  
  <p><strong>How can this be done in C#?</strong></p>
  
  <p><strong>Note:</strong> This is not a duplicate of <a href="https://stackoverflow.com/questions/2942299/converting-cidr-address-to-subnet-mask-and-network-address">this question</a>, since I'm asking about a C# implementation and not Java.</p>