C# Get File Name/Extension

Path.GetFileName(@"c:\temp\myfile.txt")

Path.GetFileNameWithoutExtension(@"c:\temp\myfile.txt")

Path.GetExtension(@"c:\temp\myfile.txt")

Comments

  1. Thanks, all answers should be this easy and short. Exacly what i needed.

    ReplyDelete
  2. Cheers.. This place is just my quick reference for common problems.. don't have time to write description :)

    ReplyDelete

Post a Comment

Popular posts from this blog

Parse XML to dynamic object in C#

Tibco Rendezvous (tibrv) C# .Net example