title: Removing drive (or network name) from path in C#
body: <p><strong>What's the most concise (but safe) way to remove a drive name, network path, etc. from an absolute path in C#?</strong></p>
  
  <p>For example, converting</p>
  
  <pre><code>\\networkmachine\foo\bar
  </code></pre>
  
  <p>or</p>
  
  <pre><code>C:\foo\bar
  </code></pre>
  
  <p>to <code>\foo\bar</code>.</p>
  
  <p>There seem to be a good number of questions already answered with regards to path matters, but I couldn't quite find what I was looking for.  My own first thought that came to mind was to use Path.GetFullPath() to ensure I'm indeed working with an absolute path and then to just use a regular expression to find the first slash that isn't next to another one.  However, using a regular expression to do path manipulation seems slightly dangerous.</p>
  
  <p>Would it perhaps be wiser to get the drive letter/target network machine/etc, convert the strings to Uri, and ask for the path relative to the drive/machine, and then convert back to strings?  Or is there an even better approach?</p>