title: C#: Get first directory name of a relative path
body: <p>How to get the first directory name in a relative path, given that they can be different accepted directory separators?</p>
  
  <p>For example:</p>
  
  <pre><code>foo\bar\abc.txt -&gt; foo
  bar/foo/foobar -&gt; bar
  </code></pre>