title: Get the (last part of) current directory name in C#
body: <p>I need to get the last part of current directory, for example  from <code>/Users/smcho/filegen_from_directory/AIRPassthrough</code>, I need to get <code>AIRPassthrough</code>. </p>
  
  <p>With python, I can get it with this code.</p>
  
  <pre><code>import os.path
  
  path = "/Users/smcho/filegen_from_directory/AIRPassthrough"
  print os.path.split(path)[-1]
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>print os.path.basename(path)
  </code></pre>
  
  <p>How can I do the same thing with C#?</p>
  
  <h2>ADDED</h2>
  
  <p>With the help from the answerers, I found what I needed.</p>
  
  <pre><code>using System.Linq;
  string fullPath = Path.GetFullPath(fullPath).TrimEnd(Path.DirectorySeparatorChar);
  string projectName  = fullPath.Split(Path.DirectorySeparatorChar).Last();
  </code></pre>
  
  <p>or </p>
  
  <pre><code>string fullPath = Path.GetFullPath(fullPath).TrimEnd(Path.DirectorySeparatorChar);
  string projectName = Path.GetFileName(fullPath);
  </code></pre>