Tuesday, July 17, 2012

Get File Name from path string

I have seen many young developers are struggle with getting
the only the file name from the full path.

Here is a simple code snippet to get the file name.

string path = "C:\\TEMP\\temp.bmp";
string fileName = System.IO.Path.GetFileName(path);

Happy coding.

0 comments:

My Achievements
Member of
Blog Archive
Followers
free counters