Tuesday, 9 June 2009

C# Get File Name/Extension

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

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

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

2 comments:

Thor said...

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

madeinstein said...

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

Post a Comment