title: Get file extension or "HasExtension" type bool from Uri object C#
body: <p>Quick question:</p>
  
  <p>Can anyone think of a better way then RegEx or general text searching to work out whether a Uri object (not URL string) has a file extension?</p>
  
  <ul>
  <li>A Uri object generated from <a href="http://example.com/contact" rel="noreferrer">http://example.com/contact</a> DOES NOT</li>
  <li>A Uri object generated from <a href="http://example.com/images/logo.png" rel="noreferrer">http://example.com/images/logo.png</a> DOES</li>
  </ul>
  
  <p>Any thoughts welcome. Apologies if I've missed something in the .NET framework / Uri class that already does this.</p>
  
  <hr>
  
  <p>Slightly more complexity wise.</p>
  
  <ul>
  <li>A Uri object generated from <a href="http://example.com/contact.is.sortof.valid" rel="noreferrer">http://example.com/contact.is.sortof.valid</a> DOES NOT</li>
  <li>A Uri object generated from <a href="http://example.com/images/logo.is.sort.of.valid.png" rel="noreferrer">http://example.com/images/logo.is.sort.of.valid.png</a> DOES</li>
  </ul>
  
  <hr>
  
  <p>I've accepted craigtp's answer; however, for what I need the solution is thus.</p>
  
  <pre><code>var hasExtension = Path.HasExtension(requestUri.AbsolutePath);
  </code></pre>
  
  <p>To all who had a go at this. For a full and comprehensive answer, you would obviously need a mime types dictionary to do a further check. For example <em><a href="http://example/this.is.sort.of.valid.but.not.a.mime.type" rel="noreferrer">http://example/this.is.sort.of.valid.but.not.a.mime.type</a></em> would return "true" has <code>Path.HasExtension</code>, however, for what I need, I would never have this type of path coming in.</p>